where (test)
Purpose
Matches objects against tests.
Syntax
where <test>
Description
In the definitions part of a rule, you can use one or
more where clauses with the set construct to test that an object meets one or more
conditions in order to be a valid value for the variable being declared. In the definitions part of the rule, the where statement does not end with a comma. Instead, each set construct should end with a semi-colon (;).
In the if part of a rule, you can use one or more
where clauses in count conditions (there is more than, there is
less than, and so on) to test that an object meets one or more conditions before being
counted.
In a where construct, an implicit variable that
refers to the current instance of the object being tested is automatically declared. In the test,
you can thus refer to potential instances of the variable as this
<object> (or each
<object> if they are part of a collection.)
Example
The following example shows the definitions part of a
rule that defines the local variable 'expensive items'
as a collection of items whose price is greater than 100. The implicit variable each item is used in the where clause to refer to each item object in
the collection.
definitions
set 'expensive items' to all items
where the price of each item is more than 100;