Define Custom Functions

You can create new functions to use in a data model. For user interface details, see New/Edit Function Dialog Box.

Note: Custom functions are executed directly on the database layer. If your existing virtual services contain custom functions, changing the database during installation or an upgrade can render them non-functional.

Custom function variables

You can use the following variables to configure a new, custom function:

Variable Description
$input_string The original string is automatically quoted in the place of usage.
$input_string_unquoted The original string is not automatically quoted.
$input_int The original string is converted to the int data type, for integer data. It contains NULL if the input string is not of this data type.
$input_float The original string is converted to the float data type, for floating point numeric data. It contains NULL if the input string is not of this data type.
$input_date The original string is converted to the date data type, to define a date. It contains NULL if the input string is not of this data type.
$data_string The actual data, converted to the string data type.
$data_int The actual data, converted to the int data type.
$data_float The actual data, converted to the float data type.
$data_date The actual data, converted to the date data type.

Back to top

Examples

Following are examples of custom functions:

To do this... Use this...
Match request data (cast to integer) smaller than actual value (cast to integer) found in the column $input_int < $data_int
Match request data (cast to integer) smaller than actual value (cast to float) found in the column $input_int < $data_float
Match actual value found in the column (cast to string) equal to 'cat' string $data_string = 'cat'
Match request data (cast to string) equal to 'cat' string $input_string = 'cat'
Match request data (cast to string) equal to actual value (cast to string using an SQL 'LIKE' operation) $input_string LIKE $data_string
Match request data (cast to string) equal to any string starting with the actual value found in the column

MS-SQL: $input_string LIKE $data_string + '%'

Embedded database (Firebird): $input_string LIKE $data_string || '%'

Match request data (cast to string) containing a substring 'cat' $input_string LIKE '%cat%'
Match request data (cast to date) smaller than actual data $input_date < $data_date
Match request data smaller than actual data OR request data equal to 'dogs' string $input_date < $data_date OR $input_string = 'dogs'

Back to top