Templates

The Rulebase Designer provides some basic ready to use templates.

These are present under Templates in the Rulebase Data View. Drag and drop directly into expressions.

Templates
Template Description Syntax
countFunction This template uses the count and filter functions (count and filter).

The result of filter is assigned to a temporary variable, i.e. PERISHABLE_LIST, that the count function operates on.

count( PERISHABLE_LIST := filter( CHILD_RECORDS, where PERISHABLE = 'YES' and DD = 'X' )) > 1
lookupFuncUsingEnum This template uses the enum and lookup functions (enum and lookup) to look for TEMPCODE in the enum list. lookup(TEMPCODE, enum({'FA<sep />Fahrenheit','CE<sep />Celsius'},2))
lookupFuncUsingTableDatasource This template uses the lookup and tableDatasource functions (See lookup and tableDatasource) to look for a specified distinct name from the datasource. lookup(NAME, tableDatasource('DS1',{ PRODUCTID,PRODUCTIDEXT}, where (PRODUCTID = 'abc' and PRODUCTIDEXT = 'abc'),DISTINCT_TRUE ))
lookupFuncUsingTableSql This template uses the lookup and tableSql functions (See lookup and tableSql) to look for a specified distinct name from a repository. lookup(NAME, tableSql({ var1.PRODUCTID,var1.PRODUCTIDEXT}, where (PRODUCTID = 'abc' and PRODUCTIDEXT = 'abc'),DISTINCT_TRUE ))
matchFunc This template matches variables defined in useforvars with the provided regular expression to find non-negative numbers. match(useforvars, '/^((\\d+(\\.\\d*)?)|(\\d*\\.\\d+))$/')
rollup This template uses the nvl function (See nvl) to get the value of NETWEIGHT of the child record. The result of its product (multiplied) with quantity is rolled up.

CONTAINSREL and CONTAINS_RECORD are Linktype-Relationship type user defined variables.

+(CONTAINSREL.QUANTITY * nvl(CONTAINS_RECORD.NETWEIGHT,100))
selectWhereClause This template is for use with the Select action. It shows the use of a simple expression in the where clause. mc1.PRODUCTID = '1111' and mc1.PRODUCTIDEXT = '33333'
tableInAssign This template uses the tableSql function (See tableSql) . col1 and col2 specify the columns that the table function provides values for. The second parameter provides the selection criteria for records. tableSql({COL1,COL2}, where COL1='ddddddd' and COL2='sssssssss')
toDateWithIn This template uses the toDate function (See toDate) to convert given strings to date format and then searches for DateOfBirth in them. in(DateOfBirth,{toDate('10/2/86'),toDate('12/3/56')})