INTEGER expressions return integers (whole
numbers).
INTEGER expressions can be used to combine expressions, do
arithmetic, and test conditions for conditional evaluation. The
INTEGER MATH expression can perform a variety of
operations on two values, including arithmetic, Boolean tests, and string
comparison.
Although the returned value is always an integer, the operation
itself can be performed using a variety of data types. A
TYPE expression node tells the
MATH expression what type to convert its
sub-expressions into prior to performing the operation. The operation to be
performed is supplied in an
OPERATOR expression node; the values to be operated on
are supplied in two sub-expressions.
In the
TYPE expression node, the
VALUE attribute has the following supported values:
The following
OPERATOR expression node require that the
TYPE attribute of their sub-expressions have a value
of either
INTEGER or
FLOAT:
The following
OPERATOR expression nodes require that the
TYPE attribute of their two sub-expressions have a
value of
INTEGER,
FLOAT, or
STRING.
EQUAL- returns 1 if expression 1 and expression 2 are equal, 0 otherwise.NE- returns 1 if expression 1 and expression 2 are not equal, 0 otherwise.GT- returns 1 if expression 1 is greater than expression 2, 0 otherwise.GTE- returns 1 if expression 1 is greater than or equal to expression 2, 0 otherwise.LT- returns 1 if expression 1 is less than expression 2, 0 otherwise.LTE- returns 1 if expression 1 is less than or equal to expression 2, 0 otherwise.CMP- returns 1 if expression 1 is greater than expression 2, 0 if the expressions are equal, –1 if expression 1 is less than expression 2.
The following
OPERATOR expression nodes require that the
TYPE attribute of their two sub-expressions have a
value of
STRING:
In the
OPERATOR expression nodes, the following two values of
the
VALUE attribute have slightly different behavior for
STRING than for
INTEGER:
AND- used withSTRING, returns 1 if neither expression 1 nor expression 2 is empty, 0 otherwise. Used withINTEGER, returns 1 if neither expression 1 nor expression 2 is not equal to 0.OR- used withSTRING, returns 1 if either expression 1 or expression 2 is not empty, 0 otherwise. Used withINTEGER, returns 1 if either expression 1 or expression 2 does not equal 0. See Example 2 for the use of this operator.
See the
EXPRESSION element for DTD and attribute information.
As part of an
INTEGER AND expression, this example uses two
INTEGER MATH sub-expressions to test whether the
PROP_NAME value equals the constant value.
<EXPRESSION TYPE="VOID" NAME="IF">
<EXPRESSION TYPE="INTEGER" NAME="AND">
<EXPRESSION TYPE="INTEGER" NAME="MATH">
<EXPRNODE NAME="TYPE" VALUE="INTEGER"/>
<EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/>
<EXPRESSION TYPE="INTEGER" NAME="PROP_EXISTS">
<EXPRNODE NAME="PROP_NAME" VALUE="CATEGORY_ID"/>
</EXPRESSION>
<EXPRESSION TYPE="INTEGER" NAME="CONST">
<EXPRNODE NAME="VALUE" VALUE="0"/>
</EXPRESSION>
</EXPRESSION>
<EXPRESSION TYPE="INTEGER" NAME="MATH">
<EXPRNODE NAME="TYPE" VALUE="INTEGER"/>
<EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/>
<EXPRESSION TYPE="INTEGER" NAME="PROP_EXISTS">
<EXPRNODE NAME="PROP_NAME" VALUE="SALESRANK"/>
</EXPRESSION>
<EXPRESSION TYPE="INTEGER" NAME="CONST">
<EXPRNODE NAME="VALUE" VALUE="0"/>
</EXPRESSION>
</EXPRESSION>
</EXPRESSION>
<EXPRESSION TYPE="VOID" NAME="REMOVE_RECORD"/>
</EXPRESSION>This example illustrates the use of an
OR in the
OPERATOR expression node. The example reads: If
Category equals "A" or Category equals "B", then create a new instance of the
property "ABCompanies" with the value from the Company property. The syntax
implicitly selects the first value of a given property if the property is
multi-assigned. "IDENTITY" gets the actual value of the property, while "CONST"
is a literal.
<EXPRESSION LABEL="" NAME="IF" TYPE="VOID" URL="">
<EXPRESSION LABEL="" NAME="MATH" TYPE="INTEGER" URL="">
<EXPRNODE NAME="TYPE" VALUE="INTEGER"/>
<EXPRNODE NAME="OPERATOR" VALUE="OR"/>
<EXPRESSION LABEL="" NAME="MATH" TYPE="INTEGER" URL="">
<EXPRNODE NAME="TYPE" VALUE="STRING"/>
<EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/>
<EXPRESSION LABEL="" NAME="IDENTITY" TYPE="PROPERTY" URL="">
<EXPRNODE NAME="PROP_NAME" VALUE="Category"/>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL="">
<EXPRNODE NAME="VALUE" VALUE="A"/>
</EXPRESSION>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="MATH" TYPE="INTEGER" URL="">
<EXPRNODE NAME="TYPE" VALUE="STRING"/>
<EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/>
<EXPRESSION LABEL="" NAME="IDENTITY" TYPE="PROPERTY" URL="">
<EXPRNODE NAME="PROP_NAME" VALUE="Category"/>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL="">
<EXPRNODE NAME="VALUE" VALUE="B"/>
</EXPRESSION>
</EXPRESSION>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="CREATE" TYPE="VOID" URL="">
<EXPRNODE NAME="PROP_NAME" VALUE="ABCompanies"/>
<EXPRESSION LABEL="" NAME="IDENTITY" TYPE="PROPERTY" URL="">
<EXPRNODE NAME="PROP_NAME" VALUE="Company"/>
</EXPRESSION>
</EXPRESSION>
</EXPRESSION>

