there is at most one (object)

This construct tests whether there is at most one object of a given type in the current dataset.

Purpose

You use this construct to determine whether the current dataset or the specified collection contains zero or one occurrence of a particular object.

Syntax

there is at most one <object> [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.

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

Example

The following condition tests if there is at most one Gold customer in the set of objects provided to the rule engine for execution.

if
   there is at most one customer
      where the category of this customer is Gold,
then...