Bookshelf Home | Contents | Index | PDF

## Constrain Relationship Quantity

The Constrain Relationship Quantity template has the form:

[The quantity of a relationship] [=] [a value]

The quantity of a relationship is the total number of items that have been added to the solution from the relationship. For example, a relationship contains Item A and Item B. If there is one Item A and one Item B in the solution, then the relationship quantity is two. If there are two of Item A in the solution and no Item Bs, the relationship quantity is also two.

The operator, [=], defines how the relationship quantity is related to the third operand, [a value]. The operator is limited to numeric comparisons (=, <, >, and so on).

The [a value] operand can be any of the following:

• The quantity of a product in the solution
• The quantity of items from another relationship in the solution
• The quantity of items in the solution from a class within a relationship
• The value of an attribute (the data type for the attribute must be number or integer)
• A number

The "Insert a" tab provides two sets of arithmetic functions that allow you to combine these items into expressions. For example, you could write the following rule:

The quantity of Items from Items relationship <= (2 * [Training Classes "Intro Course" Items-limit-attribute])

The first operand is the relationship: "The quantity of Items from Items relationship." The operator is "<=". The second operand is the "Items-limit-attribute."

This rule states that the quantity of items from the Items relationship must be less than or equal to twice the value of the "Items-limit-attribute" of the Intro Course. The Intro Course is located in the Training Classes relationship.

Use Constrain Relationship Quantity rules to set limits on the quantity of products from a relationship that can be in the solution. The limits can be defined as a number or as the quantity of other items, or the value of an attribute.