Select Tree Mode as Next to ROOT:, click the fact type place holder and select PO from the list as Select insert test. Select the left-hand operand. In the list, select POdestinationitem.availabilityDate. Select Expression Builder icon, as shown in In the

4-46 Oracle Fusion Middleware Users Guide for Oracle Business Rules pattern can also be a pattern block. A pattern block has a logical quantifier, negation, or aggregation that applies to the patterns and tests nested inside the block. For more information, see Section 4.8.3, How to Create Advanced Tree Mode Rules . When you work with advanced tree mode rules, Rules Designer expects you to use an aggregation pattern, including exists and not exists to combine terms from different child forests into the same rule while avoiding a Cartesian product.

4.8.2 How to Create Simple Tree Mode Rules

Given the XML schema shown in Example 4–1 and the schema instance shown in Example 4–2 , the following procedure creates the PO rule to cancel non 30-day availability items. IF the time between the order date and the date for availability of an item is more than 30 days THEN cancel the item To create simple tree mode rules: 1. Create an IFTHEN rule in your ruleset. For more information, see Section 4.3.1, How to Add Rules . 2. View advanced settings. For more information, see Section 4.5.1, How to Show and Hide Advanced Settings in a Rule or Decision Table .

3. Select Tree Mode as

Figure 4–57 shows. Figure 4–57 Simple Tree Mode Advanced Settings

4. Next to ROOT:, click the fact type place holder and select PO from the list as

Figure 4–58 shows. Working with Rulesets and Rules 4-47 Figure 4–58 Simple Tree Mode: Configuring the Root

5. Select insert test.

The IF statement now reads IF operand == operand.

6. Select the left-hand operand.

7. In the list, select POdestinationitem.availabilityDate.

8. Select Expression Builder icon, as shown in

Figure 4–59 . 4-48 Oracle Fusion Middleware Users Guide for Oracle Business Rules Figure 4–59 Adding Simple Tree Mode Expression

9. In the Expression Builder dialog, copy and delete the item shown in the

Expression area.

10. In the Expression Builder, select the Functions tab.

11. In the navigator, expand Duration and double-click the daysbetween function.

12. Remove the daysbetween argument templates, as shown in

Figure 4–60 . Working with Rulesets and Rules 4-49 Figure 4–60 Using Expression Builder to Add a Simple Tree Mode Rule

13. In the daysbetween function, paste the value you previously cut as the second

argument.

14. In the Expression Builder dialog, select the Variables tab.

15. For the daysbetween function first argument, use the navigator to expand PO and

expand header, and double-click orderDate. 16. In the Expression Builder dialog, click OK. 17. In the list, in the expression area and press Enter. 18. Select the operator and enter . 19. Select the right-hand operand and enter the value 30 and press Enter, as shown in Figure 4–61 . 4-50 Oracle Fusion Middleware Users Guide for Oracle Business Rules Figure 4–61 Simple Tree Mode: Right-Hand Operand with Value 30

20. Click insert action and from the list select modify.