Rule Sequences

This chapter covers the following topics:

Introduction to Rule Sequences

A Rule Sequence is a set of rules that are ordered sequentially according to their effective dates. Any type of rule can participate in a Rule Sequence, including Configurator Extensions.

A rule in a Rule Sequence becomes active only when its predecessor becomes inactive. Inactive rules are ignored at runtime. Create a Rule Sequence when you want to automatically deactivate one rule and activate another at a specific point in time. Effective dates are explained in Introduction to Effectivity .

You define effective dates for each rule in a Rule Sequence to determine when each rule in the set becomes active, how long it is used, and when it becomes inactive. Since a rule must become active as soon as its predecessor becomes inactive, modifying the effective date of one rule in a Rule Sequence can affect the effective dates of at least one other rule in the set. Each rule in a Rule Sequence can either have an effective date range defined or be assigned to an Effectivity Set. See Rule Sequences and Effectivity Sets .

When you create a new Rule Sequence, it contains no rules. You must then add rules to the Rule Sequence either by moving existing rules into the Rule Sequence, or by creating new rules within the Rule Sequence. By default, the effectivity of the first rule you add to a Rule Sequence is Never Effective. You can then modify the rule’s start and end dates and add other rules to the sequence. Each rule that you add to a Rule Sequence appears at the end of the sequence and is also Never Effective by default.

The effective dates of rules in a Rule Sequence cannot overlap. When you modify the effectivity of a new rule in a Rule Sequence, Configurator Developer ensures that the new rule’s effectivity does not overlap with any other rules in the sequence.

You can delete a Rule Sequence, but doing so also deletes all of the rules it contains from the configuration model.

Creating Rule Sequences is explained in Creating a Rule Sequence. Removing rules from a Rule Sequence is described in Removing Rules from a Rule Sequence.

Viewing Rule Sequences

You can view and modify Rule Sequences in the Rules area of the Workbench. Configurator Developer uses a unique icon to distinguish Rule Sequences from rules. Rules that belong to the Rule Sequence appear as children of the Rule Sequence node, and are listed in the order in which they appear in the sequence. This order corresponds to the chronological order in which each rule in the set becomes active over time.

A Rule Sequence’s details page lists all rules that the Rule Sequence contains. From this page you can reorder rules in the sequence, or edit a rule’s details (such as its effective dates). For details, see Reordering Rules in a Rule Sequence.

Modifying the Effectivity of a Rule in a Rule Sequence

After adding a rule to a Rule Sequence, you can change the rule’s effective dates or modify the Effectivity Set to which it is assigned. When you do this, Configurator Developer adjusts the date ranges of the rules that precede and follow that rule (if any) to maintain the constraints inherent in the sequence. If this is not possible, Configurator Developer displays an error and does not change the rule’s effectivity.

Following are a few examples of what occurs when you modify effective dates for rules in a Rule Sequence:

• You assign a start date to the first inactive rule in the sequence, or modify the start date of an active rule. Configurator Developer adjusts the end date of the preceding rule (if any) to match. If it cannot do this without changing the dates of other rules in the sequence, Configurator Developer displays an error message and rejects the new date.

• You modify the end date of an active rule, and the following rule is active, Configurator Developer adjusts the start date of the rule that follows. If it cannot do this without changing the dates of other rules in the sequence, Configurator Developer displays an error message and rejects the new date.

• You deactivate the last active rule in a sequence by setting it to Never Effective, and that rule has a predecessor. Configurator Developer sets the end date of the predecessor to what was previously the deactivated rule’s end date.

• You deactivate a rule that is not the last active rule in the sequence. Configurator Developer displays an error message. To deactivate a rule, you must move it after the last active rule in the sequence, and then set it to Never Effective.

• You assign start or end dates to an inactive rule whose predecessor is not active. Configurator Developer displays an error message because the first rule that is active must appear first in the Rule Sequence.

Rule Sequences and Effectivity Sets

To learn about Effectivity Sets, see Effectivity Sets.

When you modify an Effectivity Set’s start and end dates, and the Effectivity Set contains members of one or more Rule Sequences, Configurator Developer displays any error conditions associated with Rule Sequence date constraints and rejects the new date(s). If there are no errors, Configurator Developer applies the new dates to each rule and adjusts the effectivity dates of each rule in the Rule Sequence as necessary.

Sometimes modifying a Rule Sequence requires a change to a rule’s effective dates that conflicts with the effective dates of the Effectivity Set associated with the rule. In this case, the rule whose effective dates need to be changed will be disassociated from its Effectivity Set and the new effectivity dates will be applied directly to the rule itself. When this occurs, Configurator Developer displays a warning message and you can choose to either accept the new effectivity dates, or cancel the operation.

Some examples of how this situation can occur include:

• Activating the first inactive rule in a Rule Sequence when its predecessor is a member of an Effectivity Set.

• Adding a rule to a Rule Sequence in a position such that its new predecessor and/or successor is active and is a member of an Effectivity Set.

• Removing a rule from a Rule Sequence if its predecessor and successor is active and a member of an Effectivity Set.

• Moving a rule to a location within a Rule Sequence in which either of the previous two conditions apply.

• Adding a rule to a Rule Sequence or moving a rule within a Rule Sequence, if the rule being added or moved is itself a member of an Effectivity Set and its new position in the Rule Sequence requires a change to its own effective dates.

Reordering Rules and Rule Effective Dates

Following are some examples of how effective dates may change when you reorder rules in a Rule Sequence:

• If the rule that you move is inactive (that is, never effective and appearing at the end of the sequence), its start and end date are adjusted to be consistent with its new position.

• If its new position is at the end of the sequence or its new successor is also inactive, no changes in effectivity are necessary.

• If its new successor's start date is unbounded, the rule's start date is made equal to its new successor's old start date, the rule's end date is made equal to its new successor's old end date, and the new successor's start and end dates are both made equal to its old end date.

• If its new successor's start date is finite, the rule's start date and end date are both made equal to the new successor's start date.

• If the rule that you move is active (effective for some period of time), Configurator Developer:

• Adjusts the start and end dates of the rule's old predecessor and successor to fill the gap created when you moved the rule. You can then modify these dates as required.

• Adjusts the start and end dates of the rule that you moved to be consistent with its new context. For example:

• If its new predecessor is inactive, the rule that you moved becomes inactive.

• If its new successor's effective dates range have specific start and end dates, both the start and end date of the rule that you moved are set to its predecessor’s end date. You can then modify these dates as required.

To reorder rules in a Rule Sequence, see Reordering Rules in a Rule Sequence.

To remove a rule from a Rule Sequence, see Removing Rules from a Rule Sequence.