A circumstance is an optional qualification available for all rules. Using a circumstance allows your application to support multiple variants of a rule. For example, variations of an ordinary rule instance can be created for different customer status levels or for different geographic locations.
A circumstance-qualified rule instance (often referred to as a "circumstanced rule") is always based upon an unqualified rule instance (base rule). You can circumstance a base rule with a single property and its value, or with multiple properties and their values (called multivariate circumstancing). The circumstanced rule is selected by rule resolution if the value of the circumstance property on the rule matches that property's value on the clipboard at runtime.
On many displays, a icon identifies a circumstance-qualified rule instance. A icon identifies a base rule instance that has one or more circumstanced instances. The rule form for a circumstance-qualified rule displays the property and its value next to the Circumstance label located in the top right area of the form.
Assume that you have difference pricing levels for your customers. You first define a base pricing rule for all customers. Then you qualify the base rule by creating circumstanced rules for customers at different buying levels. The property .CustomerType
is part of the customer order and has values of "Silver" and "Gold". In this example, a customer has purchased a $100 item. Using the property and values, you create circumstance-qualified instances of the base rules as shown here:
When the system processes the order, the value of that property dictates which rule is run and thereby determines the discount (if any) the customer receives.
The circumstance property is identified only by name, without an Applies To key part. At runtime, the system uses the Applies To class of the circumstanced rule itself to find the property and its value, to compare with the literal value in the circumstanced rule or rules. So, if a circumstanced rule is encountered during execution of an activity, the circumstance property (.CustomerType in the above example) must be found on the primary page of the activity (not on the step page of the current step).
For information on how rule resolution processes circumstanced rules, see How the system finds rules through rule resolution. See also the PDN article 25168 About rule resolution.
Contrasting single-value with multivariate circumstances
If you use multivariate circumstancing, you create two rules in the Save As form:
Creating a circumstance-qualified rule
To create a circumstance-qualified rule, first define an unqualified or base rule instance (with the Circumstance values left blank). Then use the toolbar Save As button () to create a second rule qualified by a circumstance. If the original rule has an Applies To class as an initial key part, the circumstance-qualified rule must have the same Applies To class or a subclass derived from that class.
For instructions on how to create circumstance-qualified rules, see these PDN articles:
Finding circumstance-qualified rules
Select> Process and Rules > Tools > Find Rules > Find by Circumstance to create a list view report comprising single-property and multiple-property circumstanced rules. You can filter the report by searching on the following default circumstance properties: U.S. State Codes, Channels, and Customer Level. You can also search for circumstance-qualified rules by entering text used in key parts (Applies To or Name) in the Name Contains field.
For more information on how to report on circumstanced rules, or how to add or change the circumstance property columns for the report, see the PDN article 25220 How to find rules with a specific circumstance .
For decision trees, decision tables, and map values, you can redirect one circumstance-qualified rule to another circumstance-qualified rule (a peer with the same base rule), to reduce the number of distinct rules that you need to maintain. Select the Redirect this rule checkbox on the Results tab.
Circumstances are available only for certain rule types — those with the Allow Selection based on Property Rules? box selected on the Class form defining the rule type. As of V5.4, you can circumstance-qualify Declare-Constraints, Declare-Expression, and Declare-OnChange rules.
You can circumstance-qualify Rule-PortalSkin rule types. You cannot use circumstances with a final rule.
If a circumstance-qualified stream rule contains JSP tags (rather than directives), the base rule must also contain JSP tags rather than directives. Conversely, if the time-qualified rule contains directives, the base rule must contain directives.
If two rules with the same Applies To key part and family name are both unqualified and each has one or more associated property circumstance-qualified rules, the same circumstance property must be used. For example, if activity MyClass.Alpha has an associated circumstance-qualified rule using property .State, then another activity MyClass.Alpha cannot have a circumstance rule with any property other than .State.
Database software supporting your PRPC system limits the number of columns that can occur in any database table. When creating a Circumstance Definition rule, you may not exceed this limit. See PDN article 25322 Troubleshooting: "Exceeds the maximum number of columns" when creating a Circumstance Definition rule.
In releases before V5.2, circumstance-qualified rules with a RuleSet version number lower than the RuleSet version of a base rule were ignored (never selected) during rule resolution. Starting with version V5.2, this is not the default rule resolution behavior: you can copy a base rule to a higher version without the need to also copy each of the (possibly many) qualified rules associated with the base rule into that higher version. If desired, you can revert in specific cases to pre-5.2 behavior by selecting the Base Rule checkbox on the form produced by the Availability toolbar button ().
Use the Data-Circumstance-Duplicates.CircumstanceMultiples.ALL report to identify single circumstance-qualified rules that incorrectly use two or more different properties. Such conflicts can arise when rules are imported into a RuleSet that already contains some circumstanced rules. To access this report, select > Application > Inventory > Inventory Reports. Enter Rule
as the Category and circumstance as the search text.