Conditions that compare statements
You can build conditions that compare and manipulate numeric and boolean (true or false) values, dates, text strings, and attributes of events and entities.
The following examples illustrate some text, numerical, and time operators.
To view the list of operators available in the rules, see Business rule language.
- starts with and ends with
You can use the text operators starts with and ends with to determine whether a text string starts or ends with a specific sequence of characters:
if the maintenance number of 'the customer' starts with “TX” then print "redirect the call to call center A";
- is more than and is less than
You can use the numerical operators is more than and is less than to compare two numerical values:
if the purchase value of 'the shopping cart' is more than $100 then print "apply a 10% discount to the value of the shopping cart";
- after and before
You can use the date and time operators after and before and other operators, to compare time points:
definitions set 'the pickup date' to the pickup date of 'the rented car'; set 'the scheduled return date' to the scheduled return date of 'the rented car'; if the return date of 'the rented car' is after 'the pickup date' and before 'the scheduled return date' then...The following rule is applicable only when the agent receives the return event.
when a return event occurs, called 'the return' definitions set 'the purchase' to a purchase event; if 'the return' is after the period of 1 week after 'the purchase' then...
For more information on time and location comparisons, see Reasoning over time and events and Reasoning over geographic locations.