The number of rule sets that you configure in a rule specification depends on the facts that you need to determine about the input data.
You can configure rule sets in the following ways:
•Configure rule sets that read a single input.
•Configure rule sets that use rule statement conditions in a dependent relationship.
•Configure rule sets that use rule statements in an independent relationship.
•Configure a parent rule set and child rule sets.
Rule sets that use a single input
Configure a rule set to read a single data input when you want to analyze a range of data values in an input column. Define rule statements that apply the same condition logic to the input, and define a different action for the outcome of each condition.
Single input example
An airline sells airplane tickets online. The airline sells tickets at different prices for travelers in different age groups. The airline defines a business rule that requires the customer database to identify the age group of each traveler. You configure an input that represents the date-of-birth data in a customer data set. You create a series of rule statements that compare the data values in the input data to the current date.
You configure a rule set with the following rule statements:
IF AGE >= 65 THEN SENIOR
OR IF AGE >= 18 THEN ADULT
OR IF AGE < 18 THEN STUDENT
The rule set returns data from the first rule statement that can generate an action. Therefore, the order of the rule statements is relevant. If the rule set reads the second rule statement first, the rule set cannot identify any traveler in the senior age category. When the rule set reads the second rule statement first, the rule set identifies all traveler who are 18 years or older as adults.
Rule sets with dependent conditions
Configure a rule set with rule statement conditions in a dependent relationship when the business rule requires multiple conditions to be true. Define a rule statement that applies a set of related conditions to the inputs, and define a single action for the conditions.
Use an AND operator in the rule statement to join the conditions.
Dependent conditions example
A city bus company wants to hire bus drivers. The bus company requires all drivers to pass an eyesight test and to hold a license to drive a bus. The company defines a business rule that requires the employee database to verify the eyesight test status and the license status for each driver. You create inputs that represent the data for the eyesight test and the license. You configure a rule statement with a condition for each input. You configure the default rule set to return a string when an input to the earlier rule statement is not valid.
You configure a rule set with the following rule statements:
IF EYESIGHT TEST IS YES
AND DRIVERS_LICENSE IS YES THEN OK
OR IF NO RULE STATEMENT IS VALID THEN NOT_OK
Rule sets with independent conditions
Configure a rule set with rule statements in an independent relationship when the business rule requires one of multiple conditions to be true.
Independent conditions example
A bank wants to offer credit cards to customers. The bank decides that any customer with a credit balance greater than $5,000 or a salary greater than $50,000 qualifies for a credit card. The bank defines a business rule that requires the customer database to identify the eligible customers. You configure inputs that represent the customer salary and the customer balance. You configure a rule statement to test each input.
You configure a rule set with the following rule statements:
IF CUSTOMER SALARY >= 50000 THEN OFFER_CARD
OR IF CUSTOMER BALANCE >= 5000 THEN OFFER_CARD
The rule set returns data from the first rule statement that can generate an action. However, the order of the rule statements is not relevant in the example. If the data on any input is valid, the input row is valid.
Rule sets in parent and child relationships
When a business rule describes a data requirement that depends on other data requirements, configure rule sets in a parent-and-child relationship.
Parent and child example
A hardware store sells wood preserver in multiple colors and styles. The store must verify that the product database tracks the inventory of wood preserver in the warehouse. The store defines a business rule that requires the product database to maintain accurate data for the colors, styles, and units of wood preserver. You configure child rule sets with rule statements that verify the data for each type of wood preserver. You configure the parent rule set to verify the output from the child rule sets.
You configure the following child rule sets:
Rule set name: Color
IF COLOR = (PINE, OAK, CHESTNUT) THEN GOOD_COLOR
Rule set name: Size
IF SIZE = (250, 500, 1000) THEN GOOD_SIZE
Rule set name: Style
IF STYLE = (GLOSS, MATT) THEN GOOD_STYLE
You configure the following parent rule set:
Rule set name: Wood Preserver
IF COLOR = GOOD_COLOR
AND SIZE = GOOD_SIZE
AND STYLE = GOOD_STYLE THEN WOOD PRESERVER IS GOOD_PRODUCT
To configure a condition to compare an input to a range of values, select the Input: List of Values option in a function condition. You can configure similar parent rule sets and child rule sets for other products in the inventory.
Note: You might also create dictionaries that contain lists of the acceptable colors and styles. Configure the conditions to compare the input values to the dictionaries.