there are at most (number) (objects)

This construct tests whether there is no more than a specified number of objects of a given type in the current data set.

Purpose

You use this construct to determine whether the current data set or the specified collection contains no more than the specified number of occurrences of a particular object.

Syntax

there are at most <number> <objects> [in <list>] [where <test>,*]

Description

Use the optional in clause to apply the test to a specific collection of objects. Use one or more optional where clauses to filter the objects to be counted with one or more conditions. Use an optional time filter operator to filter the objects to be counted according to a specific time period or time point.

This construct can only be used in the if part of a rule.

Note:

The <number> argument cannot be a BigDecimal or a BigInteger. Although the language parser does not generate an error, an error may be generated.

Example

The following condition tests if the number of purchase events with an amount greater than 100 in the last two days is lower than or equal to 3.

if
   there are at most 3 purchase events during the last period of 2 days
      where the amount of each purchase event is more than 100
then...