where (test)

The where <test> construct matches objects against tests.

Purpose

This construct tests that an object meets a condition.

Syntax

where <test>[,]*

Description

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 type> (or each <object type> if they are part of a collection.)

Example

The following example shows the where clause used together with the there is one construct in the if part of a rule to test if there is a purchase larger than 100. The implicit variable this purchase event is used in the where clause to refer to the purchase event being tested.

if
    there is one purchase event
        where the amount of this purchase event is more than 100,