Connect CDC Director complex expressions consist of a combination of programming statements that produces a return value (which may be Boolean).
The supported programming statements are compliant with the Java or C grammar for these statements, except as noted in the Expression Handler appendix in the Connect CDC Director System Reference.
Simple expressions cannot contain statements.
Basic rules for complex expressions include:
-
The first statement must be a “begin” statement (for an unnamed expression) or a “procedure” statement (for a named expression, or procedure).
-
The last statement must be an “end;” statement.
-
Statements must be terminated with a semi-colon (;).
-
Use uppercase or lowercase but not mixed case for statement names and other reserved words.
-
Blocks, or multiple statements grouped within left and right braces ({. . .}), may be specified anywhere a single statement can be used.
The following table lists the operators and their descriptions.
Operator |
Description |
---|---|
BEGIN RETURNS type; |
Denotes the beginning of an unnamed complex expression |
END; |
Denotes the end of an expression. |
DECLARE type var; |
Defines a variable in a complex expression. |
DECLARE type var = <value expr> |
Defines a variable in a complex expression and initializes it to the value calculated by the value expr>. |
FOR (init; test; incr){ }; |
Executes a command to iterate over a range of values. The general form of the for statement can be expressed like this:
All these components are optional. In fact, to write an infinite loop, you omit all three expressions. |
WHILE ( ){ }; |
Executes a command while a specified condition is true. |
DO ( ) { }; |
Executes a command to evaluate the expression at the bottom of a loop instead of at the top. Thus the statements associated with a do are executed at least once. |
IF ( ) { } ELSE ( ); |
Executes a command only if a specific condition is met; otherwise, executes another command. |
SWITCH ( ) { }; |
Evaluates a variable that can later be matched with a value specified by the CASE keyword in order to execute a group of statements. |
CASE val; |
Defines a group of statements to begin executing if a value specified matches the value defined by a preceding SWITCH keyword. |
DEFAULT; |
Optionally used after all CASE conditions in a SWITCH statement. If all CASE conditions are not matched by the value of the SWITCH variable, the DEFAULT keyword will be executed. |
BREAK; |
Forces an immediate exit from a loop. |
RETURN val; |
Executes a command to exit from the current method. The flow of control returns to the statement that follows the original method call. To return a value, put the value (or an expression that calculates the value) after the return keyword: return ++count; |
== |
Is equal. |
!= |
Is inequal. |
>= |
Is greater than or equal to. |
<= |
Is less than or equal to. |
> |
Is greater than. |
< |
Is less than. |
&& |
And |
|| |
Either/or |
! |
Not |
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
% |
Remainder (or mod) |
, |
Delimiter, separates items. |
CR |
Starts a new line. The CR can be used when coding expressions and is ignored by the expression parser. |
/* comments */ |
Places comment text. |
Type |
CHAR(acter) DEC(imal) BOOLEAN DOUBLE INT(eger) |