Product Administration Guide > Configuration Rule Template Reference >

Set Preference


The Set Preference template has the form:

When possible, constrain [an expression] to be true with a [specified priority]

The expression in a preference rule is enforced as a constraint only if it does not conflict with any other rule type or with any user selections. The purpose of the Set Preference template is to allow you to create soft constraints that guide the eConfigurator engine in producing solutions but which the engine can ignore if needed to avoid conflicts or performance problems.

A key use for preference rules is to cause a default selection of Item B based on the selection of Item A. This is called a dynamic default. You can set a default dynamically based on a previous user selection. The user can then override the default if desired by making choosing a different item than the dynamic default.

For example, you could write the following rule:

When possible, constrain [Item A requires Item B] to be true with a priority
of [0].

When the user picks Item A, the engine will attempt to create a solution containing Item B. However, the engine is free not to include Item B in order to avoid conflicts and performance problems.

If the user does not want Item B, they can remove it without creating a conflict. If you had written the rule as "Item A requires Item B", Item B would be added when the user picks Item A. If the user tries to remove Item B, they would receive a conflict message.

Another use for the Set Preference Template is to set or modify the default value for an attribute. To do this, you would write a preference rule where the expression, is Attribute A = value. The attribute would then be displayed with this value unless overridden by another rule.

The priority operand in preference rules determines the order in which multiple preference rules for an item are evaluated. Preference rules with priority 0 that apply to a specific item are evaluated first. Those with priority 1 that apply to that item are evaluated next, and so on.

For example, you have written two preference rules that apply to a specific relationship. PrefRule A has a priority of 0. PrefRule B has a priority of 1. The eConfigurator engine will attempt to add PrefRule A to the solution before attempting to add PrefRule B.

Here is how the eConfigurator engine creates solutions containing preference rules:

  • The engine generates a solution that enforces all constraints and user choices but does not include preference rules.
  • The engine then adds the preference rules one at a time for each item. It begins by adding the highest priority preference rules for an item first. Preference rules with the same priority are added in arbitrary order.
  • If the solution remains valid when a preference rule is added, then the expression in the preference rule is enforced as a constraint and becomes part of the solution.
  • If adding a preference rule creates a conflict so that the solution fails, the preference rule is skipped, and its expression is not enforced. The engine then goes on to the next preference rule.
  • Preference rules are evaluated after all other rule types and before the engine searches for and sets default attribute values.
Product Administration Guide