Expression constraints and table constraints in product configuration models

Completed

Constraints control the attribute values that you can select when you configure products for a sales order, sales quotation, purchase order, or production order. You can use expression constraints or table constraints, depending on how you prefer to build the constraints.

Expression constraints

Use of a constraint-based product configuration model implies that some limitations exist when the user selects values for the various attributes. Such limitations can be implemented as expression constraints by using the Optimization Modeling Language (OML).

Expression constraints are characterized by an expression that uses arithmetic and Boolean operators and functions. An expression constraint is written for a specific component in a product configuration model. It can't be reused by or shared with another component. However, the expression constraints for a component can reference attributes of the component's subcomponents.

Alternatively, a constraint can be implemented in the form of a table constraint.

Table constraints

A table constraint is included in a product configuration model by referencing the table constraint definition and mapping the relevant attributes in the model to the columns in the table constraint.

Table constraints can be user-defined or system-defined:

  • A user-defined table constraint is built by the user. The user selects a combination of attribute types to represent the columns of the table and then enters values from the domains of the selected attribute types to form the rows in the table constraint.

    A user-defined table constraint is static and consists of columns that represent attribute types. Each row is a legal combination of attribute values that are taken from the attribute types.

  • A system-defined table constraint is defined by selecting which Supply Chain Management table to use as a reference and then selecting fields from this table to form the columns in the constraint. The rows of the table constraint are the rows of the Supply Chain Management table that are present at configuration time.

Table constraints list the combinations of values that are allowed for attributes when you configure a product. Table constraint definitions can be used generically. When you create a table constraint for a component in a product configuration model, select a table constraint definition. To create the combinations that are allowed, you can add attributes of specific types to the components. Each attribute type has a specific value.

The following example shows how you can limit the configuration of a speaker to specific cabinet finishes and fronts. The first table shows the cabinet finishes and fronts that are generally available for configuration. The values are defined for the Cabinet finish and Front grill attribute types.

Attribute type Values
Cabinet finish Black, Oak, Rosewood, White
Front grill Black, Metal, White

The next table shows the combinations that are defined by the Color and finish table constraint. By using this table constraint, you can configure a speaker that has an oak finish and a black grill, a Rosewood finish and a white grill, and so on.

Finish Grill
Oak Black
Rosewood White
White Black
White White
Black Black
Black Metal

Syntax

When writing constraints, you must use Optimization Modeling Language (OML) syntax. The system uses Microsoft Solver Foundation (MSF) constraint solver to solve the constraints.

Using table constraints or expression constraints

You can use either expression constraints or table constraints, depending on how you prefer to build the constraints. A table constraint is built as a matrix, whereas an expression constraint is an individual statement. When you configure a product, it doesn't matter what kind of constraint is used. The following example shows how the two methods differ.

When you configure a product by using the following constraint setups, these combinations are allowed:

  • A product in the color Black, and in size 30 or 50

  • A product in the color Red and in size 20

Expression constraint setup

(Color == "Black" & (size == "30" | size == "50")) | (color == "Red" & size =="20")

You can write an expression constraint by using either the available prefix operators or an infix notation. For the MinMax, and Abs operators, you can't use infix notation. These operators are included as standard operators in most programming languages.

System-defined and user-defined table constraints

The two types of table constraints for components in a product configuration model are user-defined and system-defined.

Table constraints represent matrices of the allowed attribute combinations, where each row defines one set of possible attribute values.

Table constraints represent matrices of the combinations of attributes that are allowed for components in a product configuration model. Each row in the table defines one set of possible attribute values. You can declare two types of constraints in a product configuration model:

  • Expression constraint - Create an expression that defines relations between attributes to guarantee that only compatible values can be selected during product configuration.

  • Table constraint - Create a table that defines all the combinations that are allowed for a specified set of attributes. Two types of table constraints are available: user-defined and system-defined.

User-defined table constraints

A user-defined table constraint is a type of matrix that is used to describe the combinations of attribute values that are defined by attribute types. For example, if you produce speakers, you can include columns for the cabinet finish and the front grill in the user-defined table constraint.

The attribute type for the cabinet finish has four values, and the attribute type for the front grill has three values. Therefore, if constraints aren't used, there are 4 × 3 = 12 possible combinations. However, in this example, only six combinations are allowed, as shown in the following table.

Product information management > Products > Product configuration models > Constraints

Screenshot of the Constraints page highlighting the Edit table constraint option.

The information regarding the combinations is displayed on the Allowed combinations tab on the Edit table constraint page in Product information management > Products > Product configuration models > (Select a model) > Constraints > Edit table constraint.

Screenshot of the Edit table constraint page highlighting the Allowed combinations tab.

System-defined table constraints

A system-defined table constraint creates a dynamic mapping between an attribute type and a field in a table. When a system-defined table constraint is included in a product configuration model, the mapping guarantees that the data in the table is shown instead of the values of the attribute type. The result is a dynamic constraint because the table contents can be modified (by other modules, for example).

When creating a system-defined table constraint, you will select a table, optionally define the query to use, and then associate attribute types to the fields in the selected table. The types of fields must match the attribute types.

Before a table constraint can take effect on a product configuration model, the table constraint must be included in a constraint on one of the model's components. The procedure is to create a new constraint, select the table constraint type, and then select the table constraint definition to use. Finally, all fields in the table constraint must be mapped to attributes in the product configuration model.

However, it is not required to match such values as enumeration values and integer ranges. The attribute type values are replaced by the values in the field from the selected table. After you create a system-defined table constraint, you can add the constraint to a component, and then map the attribute to the column names in the table constraint.