Syntax rules for expressions
Syntax rules:
- Numbers, dates, string values, operands, object fields, operation names, variables, and functions are allowed.
- String values must be enclosed in single or double quotation marks. For variables, such as
[$END_USER$], string values enclosed in double quotation marks are resolved, whereas those enclosed in single quote marks are kept as-is. - Spaces are not a syntax error between operands in an entire expression, for example, between
operands like
+and==and inif/then/else/endifstatements. Extra spaces and no spaces are allowed. - Carriage returns (new lines) are allowed.
- Values within
[$$]are case-sensitive. This means that the special variable,[$END_USER$], must be written in uppercase in an expression. - Values outside of
[$$]are case-insensitive. This means that the names of functions are case-insensitive, for example,sum,Sum, andSUMare all valid. - String values that are enclosed in single or double quotation marks are case-sensitive. For
example, for an
if/then/else/endifstatement that contains a condition likeif “test” == “TEST”, the result is false. - Operation names must be enclosed in
[$$]and be given correctly in both spelling and case. This means that an operation that is namedGet Due Dateis written in subsequent operation expressions as[$Get Due Date$]. - Object field names must be given in the following format:
[$field group:field name$]. The field group and field name must be given correctly in both spelling and case. - Object field names that reference parent, child, and preference objects must be given in the
correct format. The object type, field group, and field names must be given correctly in both
spelling and case. For example, for
[$Child:object type/field group:field name$], the spelling and case of all names must be correct and theCinChildmust be capitalized.For more information about object fields, see Object fields.
- Add system variables, if needed. For more information, see System variables.
- Apply functions, if needed. Functions must be correct for the data type. For more information, see:
- Arguments for functions must be enclosed in parentheses.
- Starting and ending parentheses must match.
- Functions that require no arguments must have empty parentheses. For example, the
tomorrowfunction is written astomorrow(). - A function can contain another function as an argument.
- Use
if/then/else/endifstatements, if needed. For more information, see If/then/else/endif statements. - Add comments (optional). Comments must be given in the correct format.
Operands for string values
The + operand can be used on string values.
| Operand | Description | Expression | Result |
|---|---|---|---|
| + | Concatenates two or more text strings. A string value can be enclosed in either single or double quotation marks. |
"abc" + "def"
|
abcdef
|
Operands for numerical values
The following operands can be used for integer, decimal, or currency values. Add and subtract can be used for dates. If an argument is a list, the operand is applied to all items in the list.
| Operand | Description | Expression | Result |
|---|---|---|---|
| + | Add |
100.00 + 5
|
105.00
|
|
|
105.00
|
||
|
|
105.00
|
||
|
|
105.00
|
||
|
|
|
||
| - | Subtract |
100.00 - 5
|
95.00
|
|
|
|
||
|
|
95.00, 195.00, 295.00
|
||
| * | Multiply |
100.00 * 5
|
500.00
|
| / | Divide |
100.00 / 5
|
20.00
|
| ( ) | Set precedence |
|
20.00
|
|
|
697.00
|
Syntax rules for comments
You can add two types of comments to an expression:
- Paragraph comments
Enclose the text in slash single or double asterisk, for example,
/* text */or/** text **/. Optionally begin each line within the block with an asterisk. - One-line comments
- Begin a line with double slash, for example,
// text - Place the comment text after an expression, for example,
[$N1$] + 5 // Add 5 to N1
- Begin a line with double slash, for example,
Both types of comments are included in the following example expression:
/**
* KRI Indicator trend
* Calculated by comparing two KRI Value Breach Status and setting to Not Determine, Steady, Worse, Better
**/
//case 1: not enough KRI values
if count([$Child:KeyRiskIndicatorValue/OPSS-KRI-Shared:Breach Status/DescB:OPSS-KRIVAl:Value Date$]) < 2
// case 2: one of the recent has "Not Determine"
elif (( at ([$Child:KeyRiskIndicatorValue/OPSS-KRI-Shared:Breach Status/DescB:OPSS-KRIVAl:Value Date$], 0)
== ( at ([$Child:KeyRiskIndicatorValue/OPSS-KRI-Shared:Breach Status/DescB:OPSS-KRIVAl:Value Date$], 1)
// case 3: two recent ones have the same breach status