Bookshelf Home | Contents | Index | PDF

## Require

The Require template has the form:

[item or condition] requires [item or condition]

A require rule is a logical implies. If the first operand is true then the second operand is implied (must be true). For example, Item A requires Item B. This rule means that if Item A is present in the solution, then Item B must be present. Another example: Condition A requires Item B. This rule means that if Condition A is true, then Item B must be present in the solution.

A require rule is not mutual. The rule Item A requires Item B does not imply Item B requires Item A. However, if Item B is excluded then Item A is also excluded. This is because when Item B is excluded, the rule can never be true.

The require operator is functionally equivalent to the following Boolean expression:

(NOT A) OR B

In the first two columns of Table 27, a 1 means the item is present in the solution. A 0 means it is absent or excluded.

Table 27.  Truth Table for Require Expressions
A
B
NOT A
(NOT A) OR B

1

0

0

False

0

1

1

True

0

0

1

True

1

1

0

True

The table shows that a require rule behaves as follows:

• False when Item A is present and Item B is not. (If Item B cannot be present, Item A cannot be present).
• True when Item B is present and Item A is not.
• True when neither is present.
• True when both are present.

Use require rules to:

• To create a requires relationship for items in different relationships. For example, you can write a rule that if Item A in relationship 1 is picked, then Item B in relationship 2 is required.
• To add items to the configuration if a condition is true.
• To create relationships between other items (conditions) when a product is added to the solution.

#### Items

An item can be any of the following:

• A relationship or class within a relationship. For example, Relationship A requires Item B. This rule means that when any product in relationship A is present in the solution, then Item B must be present.
• A product within a relationship

When items are the operands, require rules are concerned only with presence or absence, not quantity. For example, Item A requires Item B. When the first Item A is added to the solution, the eConfigurator engine will add at least one Item B if none are present. When the second Item A is added, the engine does not add any more Item B, since at least one is already present.

Here is how the require rule works with items:

• Product A requires Product B

If Product A is present in the solution, then Product B is required. If Product B is excluded, then Product A is excluded.

• Relationship A requires Product B

If any product in Relationship A is present in the solution, then Product B is required. If Product B is excluded, then all the products in Relationship A are excluded.

• Relationship A requires Relationship B

If any Product in Relationship A is present in the solution, then at least one product in Relationship B must be present. If all the products in Relationship B are excluded, then all the products in Relationship A are excluded.

#### Conditions

Conditions can take many forms. Here is a summary of how the require rule works with conditions in general. How require rules work with specific types of conditions is covered in the sections following this one.

• Product A requires Condition B

If Product A is present in the solution, then Condition B is required to be true. If Condition B is false, then Product A is excluded.

• Relationship A requires Condition B

If any product in Relationship A is present in the solution, Condition B is required to be true. If Condition B is false, then all the products in Relationship A are excluded.

• Condition A requires Product B

If Condition A is true in the solution, then Product B is required. If Product B is excluded, then Condition A is required to be false.

• Condition A requires Relationship B

If Condition A is true in the solution, then at least one product in relationship B must be present in the solution. If all the products in Relationship B are excluded, then Condition A is required to be false.

• Condition A requires Condition B

If Condition A is true in the solution, then Condition B must also be true. If Condition B is false, then Condition A is required to be false.

#### Attribute Conditions

An attribute condition specifies an attribute value and uses it to identify the items in a relationship to which the rule applies. In the rule examples below, the attributes are defined on items in relationships within the customizable product. You can also define require rules on the attributes of the customizable product itself.

In the rules examples below, the equals operator is used in the attribute expressions. You can use all the math operators ( <, >, and so on) when writing this type of rule.

• Product A requires Attribute C = M in Relationship B

If Product A is present in the solution, then M is the only value selectable for Attribute C for all items in Relationship B.

• Relationship A requires Attribute C = M in Relationship B

If any product in Relationship A is present in the solution, then M is the only value selectable for Attribute C for all items in Relationship B.

• Attribute C = M in Relationship A requires Product B

If any product with Attribute C = M in Relationship A is present in the solution, then Product B must be present.

• Attribute C = M in Relationship A requires Relationship B

If any product with Attribute C = M in Relationship A is present in the solution, then at least one of the products in Relationship B must be present.

• Attribute C = M in Relationship A requires Attribute D = P in Relationship B

If any of the products with Attribute C = M in Relationship A are present in the solution, then P is the only value selectable for Attribute D in Relationship B.

#### Quantity Conditions

Quantity conditions compare the quantities of two items. Depending on the session context in which the quantity condition is evaluated, it either returns true/false or is enforced as a constraint.

For example you write the following rule:

(Product A > Product B) requires Product C

If the user picks Product A so that its quantity is greater than Product B, then Product C is required. In this case, the quantity condition is evaluated as true/false, and Product C is required when it is true.

Contrast this with the following rule:

Product C requires (Product A > Product B)

When the user picks Product C, the condition (Product A > Product B) is enforced as a constraint. In all further solutions, the quantity of Product A must be greater than the Product B. Also, if the quantity of Product B is greater than Product A in the solution, Product C is excluded.

#### Other Item Constraints

Several other types of conditions can also be used in require rules. In some cases these conditions do not make sense when used as the second operand in a require rule. This is because some conditions are always true (message conditions), or the condition cannot be enforced to be true (linked item conditions).

Table 28 summarizes how to use item constraints.

Table 28.  Item Constraint Usage  in Require Rules
Item Constraint
First Operand
Second Operand

Attribute Value

Yes

Yes

Consume

No

Yes

Provide

No

Yes

Exclude

Yes

Yes

Exclude List

Yes

Yes

Require

Yes

Yes

Require List

Yes

Yes

Yes

No

Message, Recommends

No

Yes

Product Quantity

Yes

Yes

Relationship Quantity

Yes

Yes

Class Quantity

Yes

Yes

#### Nested Expressions as Conditions

The Require template can itself be used as a condition in other rules. The most common templates used for writing nested rules are the Require and Exclude templates. For example, you could write the following configuration rule:

Product A requires (Product B requires Product C)

The Boolean form of this rule is as follows:

(NOT A) OR ((NOT B) OR C)

Table 29 shows the truth table for this rule.

Table 29.  (NOT A) OR ((NOT B) OR C)
Row
A
B
C
NOT A
(NOT B) OR C
(NOT A) OR ((NOT B OR C)

1

F

F

F

T

T

T

2

F

F

T

T

T

T

3

F

T

F

T

F

T

4

F

T

T

T

T

T

5

T

F

F

F

T

T

6

T

F

T

F

T

T

7

T

T

F

F

F

F

8

T

T

T

F

T

T

The table lets you analyze what happens when the user picks items. Use the following steps to do this:

1. The engine must return solutions in which all constraints are true. Eliminate any rows where the top-level expression is False. In the table above, eliminate row 7.
2. To determine what happens when the user picks and item, look at all rows that list true for that item. For example, to analyze what happens when the user picks Product A, you would look at rows 5, 6, and 8 in the table above.
3. To determine what happens when a combination of items are picked, look at all the rows that list true for both items at once. For example, to analyze what happens when the user picks both Product A and Product B, you would look at only row 8 in the table above. (Row 7 is not considered since the top-level expression is false.)
4. If only one row has the correct truth conditions, this means the eConfigurator engine will return the result shown in that row. For example, look at row 8. This is the only remaining row that lists item A and B as both true. Since this row lists C as true, this means that when both A and B are present, C must be present.
5. If several rows have the condition you are analyzing, look at the truth conditions for each unpicked item in the rows. If they are all true, the unpicked item is required. If they are all false, the unpicked item is excluded. If an unpicked item lists true in some rows and false in others, this means the unpicked item is neither excluded nor required and is available.

The table reveals that the rule has the following behavior:

• When none of the products are present, the user can pick any of the three, and the other two will not be required.
• If the user picks Product A and B, then Product C is required.

Thus, the rule's behavior can be summarized this way: when the user picks Product A, the condition "Product B requires Product C" is enforced as a constraint.

#### Multiple Operands

You can add multiple operands to a require rule by clicking the Compound Field button when you create the rule.

For example, you could create the rule:

Item A requires Item B > 2, Item C < 5

This rule means the following:

• If Item A is present in the solution, the quantity of Item B must be greater than 2
• If item A is present in the solution, the quantity of Item C must be less than 5
• If Item B cannot be greater than 2 in the solution, Item A is excluded
• If item C cannot be less than 5 in the solution, Item A is excluded

This is the same as writing two rules:

Item A requires Item B > 2

Item A requires Item C < 5