VOID
expressions return no value but are used to
perform other work. The
VOID IF
expression provides a way to perform conditional evaluation.
The sub-expressions are grouped into clauses: the first clause
consists of all the sub-expressions up to the first
EXPRNODE
element (if any) and any subsequent clauses
consist of the sub-expressions between
EXPRNODE
elements. The first clause is an
IF
clause; the first sub-expression is a condition,
and must be of type
INTEGER
. Subsequent sub-expressions form the action,
and must be of type
VOID
. If the condition evaluates to anything other
than zero, then all of the actions are evaluated, in order. If the condition
evaluates to zero, then processing moves to the next clause.
A clause introduced by an
ELSE_IF
expression node (EXPRNODE
)
behaves just like the initial
IF
clause.
ELSE_IF
clauses are optional. If included, there may
be any number. For a sample usage, see the second example below. In a clause
introduced by an
ELSE
expression node, all sub-expressions form an
action, and must be of type
VOID
. The actions are evaluated in order. The
ELSE
clause is optional. If included, it must come
last. There can be at most one
ELSE
clause.
See the
EXPRESSION
element for DTD and attribute information.
This example evaluates whether the Region property is equal to the
constant Other Italy. If two are equal, then the
REMOVE
expression deletes the property.
<EXPRESSION TYPE="VOID" NAME="IF"> <EXPRESSION TYPE="INTEGER" NAME="MATH"> <EXPRNODE NAME="TYPE" VALUE="STRING"/> <EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/> <EXPRESSION TYPE="PROPERTY" NAME="IDENTITY"> <EXPRNODE NAME="PROP_NAME" VALUE="Region"/> </EXPRESSION> <EXPRESSION TYPE="STRING" NAME="CONST"> <EXPRNODE NAME="VALUE" VALUE="Other Italy"/> </EXPRESSION> </EXPRESSION> <EXPRESSION TYPE="VOID" NAME="REMOVE"> <EXPRNODE NAME="PROP_NAME" VALUE="Region"/> </EXPRESSION> </EXPRESSION>
This example implements the following logic using
ELSE
and
ELSE_IF
expression nodes:
if (Endeca.Title == "Ad Rotator Test") Create Property AdRotate with Property Value "Yes" else if (Endeca.Title == "Sample Pages") Create Property "An Index" with Property Value "Yes" else Create Property "NoMatch" with Property Value "Nothing" end if
The example is as follows:
<EXPRESSION LABEL="" NAME="IF" TYPE="VOID" URL=""> <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="Endeca.Title"/> </EXPRESSION> <EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL=""> <EXPRNODE NAME="VALUE" VALUE="Ad Rotator Test"/> </EXPRESSION> </EXPRESSION> <EXPRESSION LABEL="" NAME="CREATE" TYPE="VOID" URL=""> <EXPRNODE NAME="PROP_NAME" VALUE="AdRotate"/> <EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL=""> <EXPRNODE NAME="VALUE" VALUE="Yes"/> </EXPRESSION> </EXPRESSION> <EXPRNODE NAME="ELSE_IF" VALUE=""/> <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="Endeca.Title"/> </EXPRESSION> <EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL=""> <EXPRNODE NAME="VALUE" VALUE="Sample Pages"/> </EXPRESSION> </EXPRESSION> <EXPRESSION LABEL="" NAME="CREATE" TYPE="VOID" URL=""> <EXPRNODE NAME="PROP_NAME" VALUE="An Index"/> <EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL=""> <EXPRNODE NAME="VALUE" VALUE="Yes"/> </EXPRESSION> </EXPRESSION> <EXPRNODE NAME="ELSE" VALUE=""/> <EXPRESSION LABEL="" NAME="CREATE" TYPE="VOID" URL=""> <EXPRNODE NAME="PROP_NAME" VALUE="NoMatch"/> <EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL=""> <EXPRNODE NAME="VALUE" VALUE="Nothing"/> </EXPRESSION> </EXPRESSION> </EXPRESSION>