Conditions that test for existence
The following definitions cover operators that test for specified data.
there are-
The operator
there aretests whether there is a specific number of business terms of a certain type in the data from the application that calls the decision.The following condition checks for two customers:
if there are 2 customers in customers then...
You can use the operator
whereto specify more conditions to apply to business terms.The following rule condition is only true if there are 10 customers, and if each customer is a member of the Gold category:
if there are 10 customers in customers where the category of each customer is Gold, then...
there are at leastandthere are at most-
The following operators check whether data contains more or fewer instances of a business term than a specified number:
-
there are at least: The condition is true if the number of occurrences of the business term is greater than or equal to the specified number. -
there are at most: The condition is true if the number of occurrences of the business term is less than or equal to the specified number.
The following condition checks that there are no more than three Gold customers:
if there are at most 3 customers in customers where the category of each customer is Gold, then...
The following condition checks whether there are more Gold customers than Silver customers. The rule starts by defining the following variables:
-
silver customers: The list of customers in the Silver category. -
silver count: The number of customers in the Silver category.
The rule then uses these variables to compare the number of Gold customers with the number of Silver customers:
definitions set 'silver customers' to all customers in customers where the category of each customer is Silver; set 'silver count' to the number of elements in 'silver customers'; if there are at least ('silver count' + 1) customers in customers where the category of each customer is Gold, then... -
there is at least one-
The operator
there is at least onechecks that there is at least one instance of a business term in the data from the application that calls the decision. The data can contain more than one instance of the business term.The following condition looks for at least one
customerobject:if there is at least one customer in customers then...
The following example checks for at least one senior Gold customer:
definitions set 'gold customers' to all customers in customers where the category of each customer is Gold; if there is at least one customer in 'gold customers' where the age of this customer is at least 65, then...