Configure rules in advanced mode to optimize how rules perform when they are applied.
Usually you use advanced mode when the rule conditions involve business objects that have
hierarchical attributes and collections.
A collection is a grouping of transactional data. For example, an expense report is a
business object that has child attributes, such as expense items. Because each item
can have a different cost center, the expense items are a collection of data that
the rule needs to evaluate across cost centers. So, the advanced rule can have a
condition that looks at all expense items but matches only for specific cost
centers.
Here’s how you generally go about creating a new rule in advanced mode:
-
Click the Properties link after the rule name and select
the Advanced Mode check box.
-
Click the Insert Pattern link in the If section to get a
pattern with the is a operator. A pattern is a way to organize sets of lines, or
tests, in the If section.
- In the field before the operator, enter any term you want that
represents the business object. This term is a variable that’s used
later in the rule.
- After the operator, select the attribute for the business object, for
example Expense Report.
-
Click the Advanced Add or Modify Options icon in the
toolbar after the pattern, and select simple test.
-
Define a condition that the rule would match on for the business object. Select
an attribute under the folder named after the variable you entered
earlier.
-
Add more conditions if you need to.
-
In the toolbar for the business object pattern, click the Add
Pattern icon.
- In the field before the operator, enter
Lists_collection.
- After the operator, select Lists.
This pattern is needed because the rule involves collections.
-
In the toolbar for the lists pattern, click the Add
Pattern icon.
- In the field before the operator, enter a variable.
- After the operator, select the attribute that the collection is based
on, for example Expense Item.
This pattern defines what the collection contains.
-
In the toolbar for the collection pattern, click the Surround
selected tests with parenthesis icon, and select
Surround.
The surround option puts the pattern you just added and other conditions you
define later within parentheses, to group them all together. Conditions
within parentheses are evaluated in their entirety, in this case, against
the collection.
-
In the drop-down list before the collection pattern, select how you want the
rule to match against the collection.
- Each: There’s a match every time something in the collection meets the
conditions. Notifications are sent for each match.
- At least one: As soon as the first match is found in the collection, a
notification is sent and the rest of the collection isn’t
evaluated.
- None: The entire collection is evaluated, and a notification is sent
when nothing matches.
- Aggregate: Use this option if you need operations like sum or average on
attributes in the collection.
-
In the toolbar after the collection pattern, click the Advanced Add
or Modify Options icon, and select simple
test.
-
Define a condition that the rule would match on within the collection,
selecting attributes under the folder named after the variable.
-
Add more conditions if you need to.
-
Configure the Then section as you would any rule.
Here’s an example of the If section for a rule in advanced mode. The rule is
looking for expense reports that total 1000 or more, where at least one of the
expense items is categorized under Travel. ER and
item are the two variables that were entered, and the
paths ER.Expense Report Total and item.Expense
Source show that the attributes were selected from folders named
after the variables.