How Redirected Rules Work
Summary
A redirected rule is a circumstance-qualified rule that is configured to reference another circumstance-qualified rule (for the same base rule). This feature allows one rule to "forward" to another.
Redirection is availablefor three rule types:
- Decision trees
- Decision tables
- Map values
NOTE: Beginning in Version 5.4, multivariate circumstance functionality is available (see How Multivariate Circumstancing Works). For Version 5.4 and later releases, you can use multivariate circumstances for these rule types, as an alternative to redirection..
Suggested Approach
Redirected rules can be used to "group" rules for easier maintenance. For example, suppose your application includes a decisiont able CalculateInvoice that calculates and routes invoices for customers. As part of this calculation, one step in the table adds in the state income tax.
The state income tax varies by state. Suppose that:
- 30 states have the same rate – 5%
- 10 states have another rate – 3%
- 10 states each have a different rate (none, 2%, 7.5%, etc.)
You could create 50 different versions of CalculateInvoice, each with its own separate decision table, but that would be cumbersome. Instead, group the states by the state code, and the tax rate.
State Code | Tax Rate |
---|---|
ME, VT, CT, MA, RI, GA, NC, SC etc. | 5% - base rate |
NV, MT, MO, ID, OR, WA, OK, NM, TX, CO | 3% |
CA | 8% |
NY | 7.25% |
IL | 4% |
NH | 0% |
etc. |
Then once you have created the first circumstanced version of CalculateInvoice (NV = 3%), you can point the other states which share that rate to the NV rule version, rather than having to copy the calculation also. (See How to create a redirected rule. )
When a rule is redirected, the system ignores the calculations in that rule form and uses the calculations in the rule that it points to.
NOTES:
- Redirected rules must point to a circumstanced version of a rule. They cannot point to the base or default version of that rule.
- Redirected rules use circumstance property qualifiers only – they do not work with multi-dimensional circumstance qualifiers (Circumstance Templates).