FPL Script Functions Syntax
See also: FPL Command
Syntax, FPL System Variables
A number of additional functions are shipped with Verj.io, but have not been added to the functions table. These can be manually added if required.
Customer created functions are also supported. See Custom functions
Syntax: |
|
|
|
Description: |
Adds the number of months specified by number1 to date1 and returns the new date. If weekdaysonly = 'TRUE' and the resulting date is a weekend (i.e. Saturday or Sunday), the returned date is adjusted to be the Monday following the new date. If weekdaysonly = 'FALSE' the new date is returned unadjusted regardless of whether or not it is a weekend. This function can only be called from an FPL script. |
|
|
Examples: |
set
NEWDATE = addmonth(OLDDATE, 3, 'TRUE'); |
Syntax: |
addresslookup (string1, string2) |
|
|
Description: |
This function is used to interface with the UK Postcode Anywhere service. Returns the number of addresses at postcode in string1. string2 must be a literal containing the name of a form field of display type selection. Populates string2 with list of addresses found, if any. |
|
|
Examples: |
set
ADDRESS_COUNT = addresslookup(POSTCODE,
'ADDRESSES'); |
Syntax: |
addressidlookup (string1, string2, string3, string4, string5, string6, string7) |
|
|
Description: |
This function is used to interface with the UK Postcode Anywhere service. Returns the number of addresses (always 1) for address id string1. string2 , string3, string4, string5, string6, string7 must be a literals containing names of form fields of display type text. Populates form fields represented by string2 , string3, string4, string5, string6, string7 with organization name, address line 1, address line 2, address line 3, town and county respectively for address id string1. |
|
|
Examples: |
set DUMMY = addresslookup(ADDRESS_ID,
'COMPANY_NAME', 'LINE_1', 'LINE_2', 'LINE_3', 'TOWN', 'COUNTY'); |
Syntax: |
addweek(date1, number1) |
|
|
Description: |
Adds the number of weeks specified by number1 to date1 and returns the new date. This function can only be called from an FPL script. |
|
|
Examples: |
set
NEWDATE = addweek(OLDDATE, 3); |
Syntax: |
addyear(date1, number1) |
|
|
Description: |
Adds the number of years specified by number1 to date1 and returns the new date. This function can only be called from an FPL script. |
|
|
Examples: |
set NEWDATE = addyear(OLDDATE, 25); |
Syntax: |
buildList(fieldName) |
|
|
Description: |
Builds the dynamic list associated with field fieldName. Fails if there is no dynamic list. Returns ‘OK’ to indicate the function has executed successfully. |
|
|
Examples: |
set RESP = buildList('MY_LIST_FIELD'); |
Syntax: |
buildlistfromtable(list_field_name, table_name, table_column_1_name, table_column_2_name )
list_field_name is the name of the field to which the list is attached table_name is the name of the table table_column_1_name is the name of the table column to be displayed in the list table_column_2_name is the name of the table column to be returned when a value is selected. This can be the same as table_column_1_name
Please note that all four parameters should be specified in quotes as shown in the example below. |
|
|
Description: |
Creates a list from a table. Returns the number of entries in the list - the return value should be assigned to a field of type INTEGER. The target field should have a display type that can display a list i.e. dropdown, radio button or checkbox. Function settablerow can be used to set the current row of the table when the user makes a selection. |
|
|
Examples: |
set NUMROWS = buildlistfromtable(
'CUSTOMERS_LIST', 'CUSTTAB', 'CUSTTAB-NAME', 'CUSTTAB-ID' ); |
Syntax: |
condense(string) |
|
|
Description: |
Returns string with all spaces removed. |
|
|
Examples: |
if [condense(NAME) = 'JohnBrown'
] ........ |
Syntax: |
contains(string1, string2) |
|
|
Description: |
Returns true if string1 contains string2. Otherwise returns false. |
|
|
Examples: |
if [ contains(USER_PREFERENCES, 'Caviar') ] ........ |
Syntax: |
datepart(date1,string2)
date1 is a field of type DATE string2 is a date part as follows:
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
Description: |
Returns a character string representing part of the date. See also formatdate function. This function can only be called from an FPL script. |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
Examples: |
set RESULT = datepart($SYSTEM_DATE,
'Q'); |
Syntax: |
dayofweek(string1) |
|
|
Description: |
Returns day of the week as a string, for the given date which must be a string in format dd/mm/yyyy. Use the datepart function in preference to this function e.g. datepart(MYDATE, ‘DF’). |
|
|
Examples: |
set COMMENTS = dayofweek('01/08/2002'); if [dayofweek( datetostring(TIMESHEETDATE) ) != 'Friday'] ....... |
Syntax: |
encrypt(value, action [,key])
value is the value to be encrypted or decrypted action either 'ENCRYPT' or 'DECRYPT' key (optional) The key to use during encryption/decryption. If this is omitted then the system encryption settings will be used. |
|
|
Description: |
Returns an encrypted or decrypted value, in the same way as encrypting form parameters. Will return ERROR if there is a problem encrypting or decrypting the value. Only previously encrypted values can be decrypted. |
|
|
Examples: |
set
ENCRYPTED_VALUE = encrypt(CUSTOMER_ID, 'ENCRYPT'); set
CUSTOMER_ID = encrypt(ENCRYPTED_VALUE, 'DECRYPT'); set
ENCRYPTED_PASSWORD = encrypt(PASSWORD_FIELD, 'ENCRYPT', 'ASECRETKEE'); |
Syntax: |
endswith(string1, string2) |
|
|
Description: |
Returns true if string1 ends with string2. Otherwise returns false. |
|
|
Examples: |
if [endswith (PRODUCT, 'OIL') ] ........ |
Syntax: |
fileexists(filepath)
filepath is a string or the name of a form field or a system variable containing the full path to a file on the server |
|
|
Description: |
Returns true if file represented by filepath exists . Otherwise returns false. |
|
|
Examples: |
if [fileexists('c:/ebase/UfsServer/generatedfiles/expenses.xls')] ........ if [fileexists($FILE_NAME)] ........ |
Syntax: |
formatdate(date1,string2)
date1 is a field of type DATE string2 is a format string as follows:
Format String Examples:
dd/MM/YYYY - 10/07/1996 EEE
MMMM dd, YYYY
- EEE dd MMM, YYYY - Tue 10 Jul, 1996 |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
Description: |
Formats
the date in date1 to the given format in string2. See also datepart function. This function can only be called from an FPL script. |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
Examples: |
set F1 = formatdate(DATE1,
'dd/MM/YYYY'); set F1 = formatdate(DATE1,
'EEE dd MMM, YYYY'); |
Syntax: |
formattemplate(string1 [ , string2 ] [ , loglevel ] )
string1 - specifies either the filename within the Velocity templates directory containing the template or the template itself depending on the contents of string2.
string2 - optional parameter. If specified it must contain either:
‘FILE’ indicates that string1 specifies a filename within the Velocity templates directory or… ‘INLINE’ indicates that string1 contains a template string
If omitted, the default for string2 is ‘FILE’.
loglevel - optional parameter. If specified it is an integer that designates the logging level. Only Velocity messages of the specified logging level or higher will be issued. Logging levels are:
Debug Info Warn Error
If omitted, the default for loglevel is 2. |
|
|
Description: |
Invokes the Velocity template engine and returns a formatted string. See Using Velocity for further details. |
|
|
Examples: |
set
RESULT = formattemplate('exampleTemplate.vm'); set
RESULT = formattemplate('#foreach
( $field in $fields )<field>$field</field>#end', 'INLINE'); |
Syntax: |
getactioncontrol() |
|
|
Description: |
Returns the name of the control that triggered the current processing. |
|
|
Examples: |
set
CONTROL_NAME = getactioncontrol(); |
Syntax: |
getcookie(name) |
|
|
Description: |
Returns the string value of a cookie called name. A zero length string will be returned if this cookie does not exist. See also function setcookie. |
|
|
Examples: |
//
Set the value of the USER_NAME field to the value of the cookie called USER set
USER_NAME = getcookie ( 'USER' ); |
Syntax: |
getcredential(string) |
|
|
Description: |
Returns the value of the named user credential. |
|
|
set EMAIL_ADDRESS = getcredential('email'); |
Syntax: |
getformsessionvariable(string) |
|
|
Description: |
Returns the form session variable with the name of string. Returns a zero length string if the form session variable does not exist. Objects are returned as a String by invoking their toString() method. Note that form session variables cannot be accessed when a form is running in batch mode.
See support for multiple sessions for more information on form sessions. See also function setformsessionvariable. |
|
|
Examples: |
set MYVAR = getformsessionvariable
( 'VAR1' ); |
Syntax: |
getlistdisplayvalue(fieldname) |
|
|
Description: |
Returns the currently displayed text for a field which is associated with a list. This is particularly useful for static list fields where there is usually a difference between the field value and the displayed value. |
|
|
Examples: |
set DISPLAYVALUE = getlistdisplayvalue
( 'MYLISTFIELD' ); |
Syntax: |
getprocessattribute(jobid, attributename) |
|
|
Description: |
Returns the value of the named process attribute for the workflow job identified by jobid.
jobid is the unique id of a workflow job attributename is the name of a process attribute |
|
|
Examples: |
set MYATTR = getprocessattribute
( TASKS-JOB_ID, 'REFERENCE_NO' ); |
Syntax: |
getsessionvariable(string) |
|
|
Description: |
Returns the HTTP session variable with the name of string. Returns a zero length string if the session variable does not exist. Objects are returned as a String by invoking their toString() method. Note that session variables cannot be accessed when a form is running in batch mode.
See support for multiple sessions for more information on http sessions and form sessions. See also function setsessionvariable. |
|
|
Examples: |
set
USER_GROUP = getsessionvariable ( 'USERGROUP' ); |
Syntax: |
gettext(string1 [, string2] [,string3]) |
|
|
Description: |
Returns a text. |
|
string1 – text id string 2 – optional namespace (must be one of 'Local', 'Shared' or 'System'). If not specified, the default is 'Local'. string3 – optional language code (as
defined in Internationalization Dialog).
If not specified, the default is the form runtime language. See Working with Texts for more details. |
Examples: |
set
TEMPTEXT = gettext('TXT50'); set
TEMPTEXT = gettext('SHR24', 'Shared'); set
TEMPTEXT = gettext('TXT501', 'Local', 'FR'); |
Syntax: |
getufskey(string) |
|
|
Description: |
Returns an encrypted value of the string. See encrypting form parameters. |
|
|
Examples: |
set ENCRYPTED_VALUE = getufskey(CUSTOMER_ID); |
Syntax: |
hascredential(string1, string2) |
|
string1
- credential name string2
– credential value |
Description: |
Returns true or false to indicate whether the user has the credential with the specified value. |
|
|
Examples: |
if [ !hasCredential('Department',
'Finance') ]
message 'Access
denied – only finance users allowed'; endif |
Syntax: |
hasrole(string) |
|
|
Description: |
Returns true or false to indicate whether the current signed on user has the required role. Returns false if no signed on user exists. |
|
|
Examples: |
if [ !hasRole('SUPERVISOR'
) ]
message 'Access
denied'; endif |
Syntax: |
instring(string1, string2, startPos)
string1 - search string string2 – containing string startPos - offset within string2 to start the search |
|
|
Description: |
Returns the position (starting from 1) of the first occurrence of string1 in string2. If string1 is not found, returns -1. If startPos is specified, it indicates the offset within string2 to start the search, where 1 represents the first character (0 is invalid and will generate an error). If specified, startPos should be a field of type INTEGER. All three parameters can be specified as form fields. Note that the search is case sensitive. To perform a case insensitive search, use the uppercase function as well e.g. set POS = instring ( uppercase(SEARCH_ARG), uppercase(SEARCH_STRING)); |
|
|
Examples: |
set F2 = instring('A','CAR');
// (result F2 = 2) set F2 = instring('B','CAR');
// (result F2 = -1) set POS = instring
( 'e', 'ebase
technology',
6); //(result POS = 8) |
isauthorised
!!
THIS FUNCTION IS DEPRECATED AS OF EBASE V3.4.0. Use isauthorized()
instead.
Syntax: |
isauthorised(string1, string2, string3)
String1 is the authorization Type String2 is the authorization Name String3 is the authorization Function |
|
|
Description: |
Returns either Y or N to indicate whether the current signed on user has the required authorization. Returns N if no signed on user exists. See Security Authorizations for more information. |
|
|
Examples: |
set ALLOWED = isauthorised('CUSTOMER',
CUSTOMER_NAME, 'Update'); if [ ALLOWED != 'Y' ]
message 'Access
denied'; endif |
Syntax: |
isauthorized(string1, string2, string3)
String1 is the authorization Type String2 is the authorization Name String3 is the authorization Function |
|
|
Description: |
Returns true or false to indicate whether the current signed on user has the required authorization. Returns false if no signed on user exists. See Security Authorizations for more information. |
|
|
Examples: |
if [ !isauthorized('CUSTOMER',
CUSTOMER_NAME, 'Update' ) ]
message 'Access
denied'; endif |
Syntax: |
isvalueinlist(string1, string2) |
|
string1
- value string2
– comma delimited list of values |
Description: |
Returns true or false to indicate whether the value is in the list. |
|
|
Examples: |
if [ !isvalueinlist(COUNTRY,
'
message 'country not supported'; endif |
Syntax: |
javamethod(class/method, method arg1, method arg2...) |
|
class/method - the name of the method including the fully qualified class
name method
arg 1 –
first method argument (optional) method
arg 2 –
second method argument (optional) method
arg n –
nth method argument (optional) |
Description: |
Call a static method in any java class in the classpath. Accepts any number of arguments. The argument and return types must all be of type java.lang.String or java.lang.Double. |
|
|
Examples: |
set TIMEZONE = javaMethod('java.lang.System.getProperty', 'user.timezone'); |
Syntax: |
joindatetime( date_field, time_field )
date_field is a field of type DATE time_field is a field of type TIME |
|
|
Description: |
Joins
a field a type DATE with a field of type TIME to create a field of type
DATETIME. This function can only be called from an FPL script. |
|
|
Examples: |
set datetime1 = joindatetime(date1,
time1); //(datetime1
is a field of type DATETIME) |
Syntax: |
length(string) |
|
|
Description: |
Returns the length of string as an integer.
|
|
|
Examples: |
if [length(ADDRESS) > 10] ........ |
Syntax: |
|
|
|
Description: |
Returns string converted to lower case. |
|
|
Examples: |
if [lowercase(INSURANCE_TYPE) = 'health' ] ........ |
Syntax: |
movefile(src, dest)
src is a string or the name of a form field or a system variable containing the full path to the source file location on the server. dest is a string or the name of a form field or a system variable containing the full path to the destination file location on the server. |
|
|
Description: |
Returns true if the source file is moved successfully to the destination. Otherwise returns false. |
|
|
Examples: |
if [movefile('c:/ebase/UfsServer/generatedfiles/expenses.xls',
'c:/expenses/expenses_01.xls')] ........ upload; if [movefile($FILE_NAME,
DEST)] ........ |
Syntax: |
replace(string1, string2, string3)
string1 is the target string string2 is the search string string3 is the replace string |
|
|
Description: |
Replaces all occurrences of string2 in string1 with string3. String2 can contain a regular expression. |
|
|
Examples: |
//
Replace all occurrences of cat with dog in PETS. set
PETS = replace(PETS, 'cat', 'dog'); |
Syntax: |
replacelinefeeds(string1) |
|
|
Description: |
Removes leading and trailing white space, carriage return/line feed and tab characters from string1. Replaces each intervening carriage return/line feed and tab character by a single space. |
|
|
Examples: |
set
F1 = replacelinefeeds(F2); |
Syntax: |
round(number1); round(number1, number2); |
|
|
Description: |
The first case returns the numerical value of number1 rounded to the nearest integer.
The second case returns the numerical value of number1 rounded to the number of decimal points specified in number2. |
|
|
Examples: |
set ROUNDED_NUMBER = round(DECIMAL_NUMBER,
2); |
Syntax: |
setcookie(name, value, age)
name is a string specifying the name of the cookie. value the value of the cookie. age is the maximum age of the cookie in seconds. |
|
|
Description: |
Sets the value of a cookie for this user. Returns 'OK' if the cookie is set or 'ERROR' if the cookie could not be set. This value will not be available to getcookie until the next request. The name should only contain ASCII alphanumeric characters and cannot contain commas, semicolons, or white space or begin with a $ character. See also function getcookie. |
|
Note: in European Union countries, it is illegal to store a cookie on a client system without first asking the user’s permission. This is generally done with a checkbox next to a statement such as: This function will result in a cookie being stored on your computer. Click here to indicate that you agree to this. See also browser topics. |
Examples: |
// add a cookie called USER, set with the
value of field USER_NAME. This cookie is set to expire in 364 days. set STATUS = setcookie
( 'ACMESIGNON', USER_NAME, 31449600); |
Syntax: |
setformsessionvariable(string1, string2) |
|
|
Description: |
Sets the form session variable string1 with the value in string2. All values are saved as type String. Returns 'OK' if the variable is set or 'ERROR' if the variable could not be set. Note that form session variables cannot be set when a form is running in batch mode.
See support for multiple sessions for more information on form sessions. See also function getformsessionvariable. |
|
|
Examples: |
set STATUS = setformsessionvariable
( 'VAR1', 'Value 1' ); |
Syntax: |
setsessionvariable(string1, string2) |
|
|
Description: |
Sets the HTTP session variable string1 with the value in string2. All values are saved as type String. Returns 'OK' if the variable is set or 'ERROR' if the variable could not be set. Note that session variables cannot be set when a form is running in batch mode.
See support for multiple sessions for more information on http sessions and form sessions. See also function getsessionvariable. |
|
|
Examples: |
set
STATUS = setsessionvariable ( 'USERGROUP', 'GROUP1'
); |
Syntax: |
settablerow( table_name, table_column_name, value )
table_name is the name of the table table_column_name is the name of the table column to be compared with value value is any string
Please note that table_name and table_column_name
should both be specified in quotes as shown in the example below. |
|
|
Description: |
Sets the current row of table table_name by looping through the table and comparing the value of table_column_name with value. The current row is set on the first occurrence that matches. Returns 'OK' if the current row was set or 'NOT SET' if no match was found. This function can be used in conjunction with function buildlistfromtable. |
|
|
Examples: |
set STATUS = settablerow(
'CUSTTAB', 'CUSTTAB-NAME', 'Acme Corp' ); |
Syntax: |
settablerowvisible( table_name, table_column_name, value [, page] )
table_name is the name of the table table_column_name is the name of the table column to be compared with value value is any string page is an optional page name (defaults to the current page if not specified)
Please
note that table_name
and table_column_name
should both be specified in quotes as shown in the example below. |
|
|
Description: |
Sets the current row of table table_name as described for function settablerow(), then scrolls the table so that the specified row is the first row displayed. Returns 'OK' if the current row was set or 'NOT SET' if no match was found. |
|
|
Examples: |
set STATUS = settablerowvisible(
'CUSTTAB', 'CUSTTAB-NAME', 'Acme Corp' ); |
Syntax: |
splitdate( datetime_field )
datetime_field is a field of type DATETIME |
|
|
Description: |
Sets a field of type DATE with the date portion of a DATETIME field. See also function splittime. Currently, if the originating datetime field is null, the destination date field will be 01/01/1970. This function can only be called from an FPL script. |
|
|
Examples: |
set date1 = splitdate(datetime1); |
Syntax: |
splittime( datetime_field )
datetime_field is a field of type DATETIME |
|
|
Description: |
Sets a field of type TIME with the time portion of a DATETIME field. See also function splitdate. Currently, if the originating datetime field is null, the destination time field will be 00:00 (i.e. midnight). |
|
|
Examples: |
set time1 = splitdate(datetime1); |
Syntax: |
startswith(string1, string2) |
|
|
Description: |
Returns true if string1 starts with string2. Otherwise returns false. |
|
|
Examples: |
if [startswith
(PRODUCT, 'X') ] ........ |
Syntax: |
timetostring(time1) time1 is the time field to format |
|
|
Description: |
|
|
|
Examples: |
set string1 = timetostring(START_TIME); |
Syntax: |
tostring(number1) |
|
|
Description: |
Returns the string value of the numeric field number1. See also datetostring and timetostring functions. |
|
|
Examples: |
set
COMMENTS = 'There are ' + tostring(count) + '
records in this set'; |
Syntax: |
trim(string1) |
|
|
Description: |
Removes leading and trailing white space from string1. |
|
|
Examples: |
set WORK1 = trim(LAST_NAME); |
Syntax: |
|
|
|
Description: |
Returns string1 converted to upper case. |
|
|
Examples: |
if [uppercase(INSURANCE_TYPE) = 'HEALTH' ] ........ |
Syntax: |
urldecode(value[,decoding])
value is the value to URL decode. decoding (optional) type of URL decoding e.g ‘UTF-8’. The default decoding is ‘ISO-8859-1’ if the decoding is not supplied. |
|
|
Description: |
Returns value URL decoded. This function should be used to decode any values that are URL encoded. |
|
|
Examples: |
set DECODED_VALUE = urldecode(ENCODED_VALUE); set DECODED_VALUE = urldecode(ENCODED_VALUE,
‘UTF-8’); |
Syntax: |
urlencode(value[,encoding])
value is the value to URL encode. encoding (optional) type of URL encoding e.g ‘UTF-8’. The default encoding is ‘ISO-8859-1’ if the encoding is not supplied. |
|
|
Description: |
Returns value URL encoded. This function should be used when a value requires URL encoding. |
|
|
Examples: |
set ENCODED_VALUE = urlencode(PARAM1); set ENCODED_VALUE = urlencode(PARAM1,
‘UTF-8’); |