Reference > Rule Languages > Business Action Language > BAL Constructs > any of the following conditions is true

Summary

Groups together a series of conditions such that the combined statement evaluates to true if one or more of the listed conditions evaluates to true.

Syntax

any of the following conditions is true:
    - <condition>* [,]

Description

The any of the following conditions are true provides a more compact and convenient alternative to the logical operator or when you want to combine multiple conditions. The resulting statement is considered true if at least one of the listed conditions is true.

This is equivalent to writing if <condition 1> or <condition 2> or ... <condition n>. However, if you have a large number of conditions, using the any of the following conditions is true construct can make the rule more readable.

The construct must be followed by a colon and one or more condition statements, each one on a separate line and preceded by a dash. Note that the dash that precedes each condition must be a `short dash'.

Optionally, you can add a comma after the last condition statement in the list to signify the end of the list of grouped. This will separate those conditions that form part of the construct from any additional condition statements that might follow.

Example

This example shows how to test if a customer is a Gold member or a senior customer.

if
   any of the following conditions is true:
       - the category of the customer is Gold
       - the age of the customer is more than 60
then...

The following more complex example shows the use of a comma to mark the end of a group of conditions. In this example, the order must be over $50 AND the customer must be EITHER a Gold customer or a senior customer AND the order must be shipping to NJ.

if
   all of the following conditions are true:
     - the order total is greater than $50
     - any of the following conditions is true:
        - the category of the customer is Gold
        - the age of the customer is more than 60,
      - the shipping address is in NJ
then...

Note
Indentation in rules is for readability only; it does not influence the way the rule is processed. Without the comma to mark the end of the any of the following conditions are true block, the final condition (the shipping address is in NJ) would be considered part of the previous group, and the rule would be interpreted to mean that the order must be over $50 and (EITHER the customer is a Gold customer or a senior customer or the shipping address is in NJ).

Related Concepts

Groups of Condition Statements

Related Tasks

Creating Business Rules

Related Reference

if
all of the following conditions are true
none of the following conditions are true

Related Samples and Tutorials

Tutorial: Creating Business Rules