Expression evaluation

This topic describes how to control evaluation of values in form fields using expressions.

Expression evaluation is based on operators and operands. All binary operators take operands of the same type. The result type of arithmetic operations is the same as the operand type. The result type of comparison and logic operations is a Boolean value (True or False).

Arithmetic operations

The binary + operator supports integer and string operands. For string operands the resulting string value is a concatenation of two operands.

The binary operators -, * and / support integer operands.

The unary operators + and - support integer operands. The + operand is complementary to the - operand and does nothing over its operand. The purpose of the unary + operand is in an expression like the following: (~CMP::rrt~ + 0). If a component replaces RRT ~CMP::rrt~ with a numeric value, the result of the expression will be the value. If a component replaces this RRT with an empty string, the expression will be still valid and the result is 0.

The allowed size depends on whether a field is signed (supports negative integers) and whether it supports 32-bit or 64-bit values.

Size Signed (+/-) Allowed values
32-bit Yes -2147483648 to 2147483647
32-bit No 0 to 4,294,967,295
64-bit Yes -9223372036854775808 to 9223372036854775807
64-bit No 0 to 18,446,744,073,709,551,615.

Integer size for AutoStore components

Component Integer size
Alfresco 32-bit
ApplicationeXtender 64-bit
Autonomy WorkSite 32-bit
Bates Stamp 64-bit
Binder 32-bit
Box 32-bit
Command Line Execution 32-bit
d.3 64-bit
Data Filter 32-bit
Directory Services 32-bit
Document Writer 64-bit
ELO 32-bit
FileNet P8 32-bit
Form Overlay 32-bit
Fortis Blue 32-bit
Google Docs 64-bit
HP TRIM / Micro Focus 32-bit
IBM CM OnDemand 32-bit
Microsoft OneDrive 64-bit
Laserfiche 32-bit
OP Binder 32-bit
OPOCR 32-bit
Office Converter 64-bit
PDF Converter 32-bit
ProLaw 64-bit
Redaction 32-bit
RightFax Route 32-bit
Send to FTP 32-bit
Send to SFTP 32-bit
Send to Printer 32-bit
SharePoint (2010) 32-bit
WebDAV 32-bit
Windream 64-bit

Logic (Boolean) operations

The unary operator ! (NOT) supports a Boolean operand. The resulting Boolean value is the logical negation.

The binary operators & (AND) and | (OR) support Boolean operands only. The resulting Boolean value is a conjunction (disjunction) of the operands. The operands are evaluated from left to right. If the result of the first operand of an AND operation is False, then the second operand is not evaluated, and the result of the expression is False. If the result of the first operand of OR operation is true then the second operand is not evaluated, and the result of the expression is True.

Note for testing purposes that when an unevaluated operand contains semantic errors, such as a type mismatch or unknown identifiers, the expression will still be evaluated successfully.

Comparison operations

The binary operators =, ==, and != (not equal) support string, integer and Boolean operands. The = operand is equivalent to == for integer and Boolean operands. For string operands, the = operator performs a case-insensitive comparison while the == operator performs a case-sensitive comparison.

The binary operators <=, >=, <, and > support string and integer operands only. These operators perform a case-sensitive comparison on strings.

Result type of all of these comparison operators is a Boolean value.

Conditional selection operation

The ternary operator ? takes three operators in the form exp_condition ? exp_result1 : exp_result2. The exp_condition must return a Boolean value. The two result operands exp_result1 and exp_result2 can be different types.

  • If exp_condition evaluates to True, then the operation evaluates exp_result1.
  • When exp_condition evaluates to False, then the operation returns exp_result2.
This ternary operation is similar to the C language ? : operator, with the difference that this implementation does not require the two result operands to be the same type.

Constants

An integer constant in a 32-bit field must be decimal numeric value from 0 to 2147483647. An integer constant in a 64-bit field must be decimal numeric value from 0 to 9223372036854775807. The unary minus operator - should be used to distinguish a negative integer constant from a positive integer constant.

A string constant must begin and end with the double quotes character ". Special characters inside of string body must be "escaped" with the backslash \ character. The following escape sequences are valid within a string constant: \" (quote), \\ (backslash), \t (tab), \v (vertical tab), \r (carriage return), \n (new line).

Boolean constant must be one of the following: ON, YES, TRUE for True and OFF, NO, FALSE for False. These constants are case-insensitive.

Examples:

  • "YES" — Is a string constant.

  • YES — Is a Boolean constant.

  • "10" — Is a string constant

  • 10 — Is an integer constant.

  • Expression (10 > 9) — Is True.

  • Expression ("10" > "9") — Is False.

  • Expression ("YES"!= TRUE) — Is invalid, because it compares operands of different types (string against Boolean).

  • Expression (FALSE == OFF) — Is true, because both Boolean constants FALSE and OFF have same Boolean value False.

  • Expression (FALSE == 0) — Is invalid, because a Boolean is compared against an integer.

  • Expression (FALSE == ((3 + 4) != 0)) — Is False.

Identifiers

Only Boolean constants are supported. Other identifiers are undefined. For example, the expression ("ABCD" == ABCD) is invalid, since the ABCD identifier is undefined.