FPL Script Functions Syntax

Documentation home

 

Additional System Functions 2

Custom Functions 2

System supplied functions 2

addmonth. 2

addresslookup. 2

addressidlookup. 3

addweek. 3

addyear 3

buildlist 3

buildlistfromtable. 4

condense. 4

contains 4

datepart 4

datetostring. 5

dayofweek. 5

elementexists 6

encrypt 6

endswith. 6

fileexists 7

formatdate. 7

formattemplate. 8

getactioncontrol 8

getcookie. 8

getcredential 9

getformsessionvariable. 9

getlistdisplayvalue. 9

getprocessattribute. 9

getsessionvariable. 10

gettext 10

getufskey. 10

hascredential 10

hasrole. 11

instring. 11

isauthorized. 12

isvalueinlist 12

javamethod. 13

joindatetime. 13

length. 13

lowercase. 13

movefile. 14

osfiles 14

replace. 14

replacelinefeeds 15

round. 15

setcookie. 15

setformsessionvariable. 16

setsessionvariable. 16

settablerow. 16

settablerowvisible. 17

splitdate. 17

splittime. 18

startswith. 18

substring. 18

timetostring. 19

tostring. 19

trim.. 19

uppercase. 20

urldecode. 20

urlencode. 20

 

See also: FPL Command Syntax, FPL System Variables

 

 

Additional System Functions

A number of additional functions are shipped with Ebase Xi, but have not been added to the functions table. These can be manually added if required.

 

Custom Functions

Customer created functions are also supported. See Custom functions.

 

 

System supplied functions

 

addmonth

 

Syntax:

addmonth(date1, number1, weekdaysonly)

 

 

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');

 

addresslookup

 

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');

 

addressidlookup

 

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');

 

addweek

 

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);

 

addyear

 

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);

 

buildlist

 

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');

 

buildlistfromtable

 

Syntax:

buildlistfromtable(list_field_name, table_name, table_column_1_name, table_column_2_name )

 

where...

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' );

 

condense

 

Syntax:

condense(string)

 

 

Description:

Returns string with all spaces removed.

 

 

Examples:

if [condense(NAME) = 'JohnBrown' ]

........

 

contains

 

Syntax:

contains(string1, string2)

 

 

Description:

Returns true if string1 contains string2. Otherwise returns false.

 

 

Examples:

if [ contains(USER_PREFERENCES, 'Caviar') ]

........

 

datepart

 

Syntax:

datepart(date1,string2)

 

date1 is a field of type DATE

string2 is a date part as follows:

 

Valid DateParts (string2)

YY  

two digit year

YYYY

four digit year

Q

quarter of the year

MM

two digit month

MMM

3 character month name i.e. Jan. Feb, Mar,  etc

MMMM

full month name i.e. January, February, March,  etc

WK

two digit week of year

DY

two digit day of year

DM

two digit day of month

WM

two digit week of month

DW

two digit day of week

DN

three character day name i.e. Mon, Tue, Wed, etc

DF

full day name i.e. Monday, Tuesday, Wednesday, etc

HH

two digit hour

MI

two digit minute

SS

two digit second

MS

Milliseconds

 

 

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');

 

datetostring

 

Syntax:

datetostring(date1 [,regionalFormatting])

 

date1 is the date field to format

regionalFormatting (optional) 'true' or 'false'.  If 'true' the return string formats according to the form's language setting.  If 'false' or unspecified, the system date format is used.

 

 

Description:

Returns a string, representing date1.

 

This function can only be called from an FPL script.

 

 

Examples:

// format the date using the system date format.
set string1 = datetostring(DOB);

// if language is specified as US_en format output will be mm/dd/yyyy.

set string1 = datetostring(DOB, 'true'); 
// formats date as datetostring(DOB), language setting is ignored.

set string1 = datetostring(DOB, 'false'); 

 

dayofweek

 

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']

.......

 

elementexists

 

Syntax:

elementexists (string1, string2)

 

string1 is an Ebase element type and must be either PRESENTATION_TEMPLATE or FORM

string2 is the element name

 

 

Description:

Returns ‘Y’ or ‘N’ to indicate whether the specified element exists.

 

 

Examples:

if [ elementexists('PRESENTATION_TEMPLATE', 'SPECIAL') = 'Y' ]

if [ elementexists('FORM', 'MY_FORM') = 'Y' ]

 

encrypt

 

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');

 

endswith

 

Syntax:

endswith(string1, string2)

 

 

Description:

Returns true if string1 ends with string2. Otherwise returns false.

 

 

Examples:

if [endswith (PRODUCT, 'OIL') ]

........

 

fileexists

 

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)]

........

 

 formatdate

 

Syntax:

formatdate(date1,string2)

 

date1 is a field of type DATE

string2 is a format string as follows:

 

Symbol

Meaning

Presentation

Example

G

era designator

Text

AD

Y

year

Number

1996

M

month in year

Number or Text

07 or July

d

day in month

Number

10

E

day in week

Text

Tuesday

D

day in year

Number

189

F

day of week in month

Number

2

w

week in year

Number

27

W

week in month

Number

2

 

Format String Examples:

 

dd/MM/YYYY                   -            10/07/1996

EEE MMMM dd, YYYY    -            Tue July 10, 1996

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');

 

formattemplate

 

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');

 

getactioncontrol

 

Syntax:

getactioncontrol()

 

 

Description:

Returns the name of the control that triggered the current processing.

 

 

Examples:

set CONTROL_NAME = getactioncontrol();

 

getcookie

 

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' );

 

getcredential

 

Syntax:

getcredential(string)

 

 

Description:

Returns the value of the named user credential.

 

 

Examples:

set EMAIL_ADDRESS = getcredential('email');

 

getformsessionvariable

 

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' );

 

getlistdisplayvalue

 

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' );

 

 

getprocessattribute

 

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' );

getsessionvariable

 

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' );

 

gettext

 

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');

 

getufskey

 

Syntax:

getufskey(string)

 

 

Description:

Returns an encrypted value of the string. See encrypting form parameters.

 

 

Examples:

set ENCRYPTED_VALUE = getufskey(CUSTOMER_ID);

 

hascredential

 

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

 

hasrole

 

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

 

instring

 

Syntax:

instring(string1, string2)

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 Ebase Security Authorizations for more information.

 

 

Examples:

set ALLOWED = isauthorised('CUSTOMER', CUSTOMER_NAME, 'Update');

if [ ALLOWED != 'Y' ]

   message 'Access denied';

endif

 

isauthorized

 

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 Ebase Security Authorizations for more information.

 

 

Examples:

if [ !isauthorized('CUSTOMER', CUSTOMER_NAME, 'Update' ) ]

   message 'Access denied';

endif

 

isvalueinlist

 

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, 'UK, Belgium, France, Germany, Holland, USA') ]

   message 'country not supported';

endif

 

javamethod

 

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');

 

joindatetime

 

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.
If the time field is either null or 0:0:0 the time is interpreted as midnight. If the date field is null, the destination datetime field will be set to null.

 

This function can only be called from an FPL script.

 

 

Examples:

set datetime1 = joindatetime(date1, time1);           //(datetime1 is a field of type DATETIME)

 

length

 

Syntax:

length(string)

 

 

Description:

Returns the length of string as an integer.

 

 

 

Examples:

if [length(ADDRESS) > 10]

........

 

lowercase

 

Syntax:

lowercase(string)

 

 

 

Description:

Returns string converted to lower case.

 

 

Examples:

if [lowercase(INSURANCE_TYPE) = 'health' ]

........

 

movefile

 

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)]

........

 

osfiles

 

Syntax:

osfiles(string1, string2)

 

string1 is a form field name and should designate a field type that can accept a list i.e. dropdown, radio button or checkbox

string2 is a folder or directory name and must end with a forward slash

 

 

Description:

Populates the list associated with the field designated by string1 with all files and folders in the folder or directory specified by string2. Returns the number of files and folders contained in the folder or directory.

 

 

Examples:

// populate a list for field FILE_LIST

set FILE_COUNT = osfiles('FILE_LIST', DIRNAME);

set FILE_COUNT = osfiles('FILE_LIST', 'C:/temp/');

 

 

replace

 

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');

 

replacelinefeeds

 

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);

 

round

 

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);

 

setcookie

 

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);

 

setformsessionvariable

 

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' );

 

setsessionvariable

 

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' );

 

settablerow

 

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.
Please note that value must be a string. For example, if the column is a date column, you need to use the "datetostring" command.

 

 

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' );
set STATUS = settablerow( 'T1', 'T1-THREE', datetostring(DATE_FIELD_1));

 

settablerowvisible

 

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.
Please note that value must be a string. For example, if the column is a date column, you need to use the "datetostring" command.

 

 

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' );
set STATUS = settablerowvisible ( 'T1', 'T1-THREE', datetostring(DATE_FIELD_1));

 

splitdate

 

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);

 

splittime

 

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);        

 

startswith

 

Syntax:

startswith(string1, string2)

 

 

Description:

Returns true if string1 starts with string2. Otherwise returns false.

 

 

Examples:

if [startswith (PRODUCT, 'X') ]

........

 

substring

 

Syntax:

substring(string, offset, number)

substring(string, offset) 

 

string is the source string

offset is an integer specifying an offset into string

number is an integer specifying the number of characters to return, and must be greater than 0

 

 

Description:

Returns a substring of string.

In the first format, returns number characters of string starting from position offset.

In the second format, returns all characters of string starting from position offset.

 

Please note that the first character in a string is denoted by an offset value of 1, not 0.

 

This function will tolerate an offset or count which is not within the range of string, and will then return the substring that most closely matches the request. The function will not abort if either offset or number reference a location outside of string. See the examples below.

Note: this command only works with a character string, not with integers. To use for integers, use 'tostring'.

 

 

Examples:

set CHARS_3TO6 = substring(PRODUCT,3,4);

// When PRODUCT contains ‘Widgets’, returns ‘dget’.

 

set PET = substring('Alligator', 5);

// Returns ‘gator’.

 

set A = substring('abc', 1, 5);

// Returns ‘abc’.

 

set A = substring('abc', 3, 5);

// Returns ‘c’.

 

set A = substring('abc', 4, 5);

// Returns an empty string.

 

 

set F1 = substring( tostring(F1),1,3);

// For when the field F1 is an integer field.

 

 

timetostring

 

Syntax:

timetostring(time1)

time1 is the time field to format

 

 

Description:

Returns a string representing time1.

 

 

Examples:

set string1 = timetostring(START_TIME); 

 

tostring

 

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';

 

trim

 

Syntax:

trim(string1)

 

 

Description:

Removes leading and trailing white space from string1.

 

 

Examples:

set WORK1 = trim(LAST_NAME);

 

uppercase

 

Syntax:

uppercase(string1)

 

 

Description:

Returns string1 converted to upper case.

 

 

Examples:

if [uppercase(INSURANCE_TYPE) = 'HEALTH' ]

........

 

urldecode

 

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’);

 

urlencode

 

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’);