CDL Expressions
An expression is usually part of (or sometimes all of) a CDL statement. It has two operands that are connected by an operator, or functions and their arguments.
Examples
The following example
shows a simple mathematical expression where the two operands are 2
and frame.border
, and the operator is *
(multiplication).
2 * frame.border
The following example
shows a simple mathematical expression
used as the second operand in another expression, where the first
operand is window.frame.width
and the
operator is -
(subtraction).
window.frame.width - 2 * frame.border
For an example of CDL rules using these expressions, consider a Window Model. If you want to calculate the size of the glass to be put into a window frame where the glass is inserted in the frame 1/2 inch at each side, and the frame border is 1 inch, you might write the two accumulator rules in the following example.
ADD window.frame.width - 2 * frame.border + 2 * 0.5 TO glass.width;
ADD window.frame.height - 2 * frame.border + 2 * 0.5 TO glass.height;
Following are some additional examples of expressions.
The following expressions result in a BOOLEAN value:
a > b
a AND b
(a + b) * c > 10
a.prop LIKE "%abc%"
The following expressions result in a INTEGER or DECIMAL value:
a + b
((a + b) * c )^10