What You Need to Know About Advanced Mode Rules

4-40 Oracle Fusion Middleware Users Guide for Oracle Business Rules Figure 4–52 Completed Aggregate Function in a Rule

16. Enter additional tests as required. For this example you enter the test for items

with color red, as Figure 4–53 shows. Figure 4–53 Using Aggregate Functions with Rules Red Color Total Cost Rule

4.7.5 What You Need to Know About Advanced Mode Rules

There are some special cases to keep in mind when you work with Advanced Mode rules, including the following: ■ When you work with aggregates, in actions, you do not see pattern variables. The pattern variables are only shown for action lists when you use foreach... patterns. Thus, you cannot see pattern variables in aggregate, there is a case, or there is no case patterns. Working with Rulesets and Rules 4-41 ■ After you select Advanced Mode the Advanced Mode stays selected and inactive gray, as long as your rule uses advanced options such as advanced pattern matching. To deselect Advanced Mode you must remove or undo the advanced mode features sometimes it is easier to start over by creating a non-advanced mode rule and then delete the advanced mode rule. To deselect the advanced mode option: 1. Select the rule or Decision Table where you want to deselect Advanced Mode. 2. Click the Show Advanced Settings icon next to the rule or Decision Table name see Section 4.5.1, How to Show and Hide Advanced Settings in a Rule or Decision Table . 3. Consider the state of the rule: ■ If you can simplify the rule to enable the Advanced Mode option such that the Advanced Mode icon changes from gray to enabled. Then simplify the rule and when Advanced Mode is enabled, deselect Advanced Mode. ■ If you can use Undo to undo the steps you used to create the Advanced Mode rule, to get to a state where the rule is no longer in Advanced Mode, then use this technique to simplify the rule. ■ If you cannot simplify the rule, then delete the rule and re-create it.

4.8 Working with Tree Mode Rules

Tree Mode rules make it easier to work with a master detail hierarchy, where there are nested elements that map to a parent child relationship.

4.8.1 Introduction to Tree Mode Rules

To introduce tree mode rules, it is instructive to work with an example. Consider the lifecycle of an application fragment that uses business processes and rules to process a retail purchase order PO. The purchase order has a header with business terms that apply to the entire PO. The PO also contains a list of shipping destinations. Each destination has an address, a list of items to be shipped to the destinations address, and a list of shipments. Consider the business rule: the status of a PO is fully shipped if the status of every item is either shipped or canceled. Figure 4–54 shows a sample XML schema representation for the PO example. The XML documents for the PO are tree structured. This allows a natural representation for the PO. For example, the PO itself is the top level document element and destinations are nested elements that contain item elements and shipment elements. Shipment elements also contain item elements that reference the ordered items. Status has a list of valid values.