Overview of Creating Statement Rules

Create a statement rule to extend your model. You can implement your own logic, accumulate values, and make sure each option in your model is compatible with other options in the model.

Here are some typical ways that you might use a statement rule.

  • Set default choices or values.
  • Automatically select an option according to other selections that your user makes.
  • Prevent you from making selections that won't work each other.
  • Specify how many instances of a model Configurator creates at run time.
  • Calculate and set the value for a numeric option.

Here are some example statement rules.

Description Code
Set the value of a text feature when you select an option.
'UserLogin'.'Do addresses match?'.'Success. Addresses match.'.State() // Success option is selected.
REQUIRES
'UserLogin'.'Address Check Result'.Value() = "Your address is accepted." // Set value of text feature.
Select an option according to a choice that your user makes.
'Task Chair'.'Cushion Width' > 30 AND 'Task Chair'.'Cushion Width' <= 50
REQUIRES
'Task Chair'.'Seat Cushion OC'.'SEAT_CUSHION_12345';
Set a default value. Weight <= 3000

Assume you need to automatically select options according to a choice that your user makes in a supplemental structure.

Assume you need to automatically select options according to a choice that your user makes in a supplemental structure.

Note

  1. You add the Trim Packages supplemental structure to your Car model, and you add options to Trim Packages, such as LX Luxury Package. At run time, your user selects the LX Luxury Package option.
  2. You add a statement rule to your model. For example, this code says that if you select LX Luxury Package, then set Interior Options to Power Seats:

'LX Luxury Package' IMPLIES 'Power Seats';

  • At run time, the rule automatically selects other options in the model according to the LX Luxury Package that your user selected:
    • Set Interior Options to Power Seats
    • Set Mechanical Options to 2.0L DOHC
    • Set Exterior Options to 16" Wheels

Here's how you do it.

Here's how you do it.
  1. Use the Rules area of the Configurator Modeling work area to add your rule to a node on the model. Each statement rule is a part of the model, just like a supplemental structure or user interface.
  2. Use the code editor to add your code. Use the code editor's features to help make sure your code is correct, such as inserting keywords, logical operators, functions, and so on. You use the Constraint Definition Language (CDL) to code each rule.
  3. Click Validate to make sure your code doesn't have any errors that will prevent Configurator from compiling it, such as syntax errors.
  4. Manage your rule. Verify its status after you validate, enable it, and end date it.

Guidelines

  • Configurator automatically imports rules when you import your item from the Product Information Management work area into Configurator. For example, when an option class that has options that are mutually exclusive.
  • A statement rule is different from a condition that you create for the user interface. A statement rule makes sure your configuration is valid, while a condition specifies how to display or whether to enable an element in a user interface depending on the value of an attribute.
  • You can have an implicit rule in a supplemental structure, such as the minimum number or maximum number of selections in an option feature.
  • You can't share a statement rule with another model, but you can manually copy it into another model.
  • Configurator ignores rules that aren't valid when you test the model.
  • You must disable or delete each rule that isn't valid before you release your workspace.

Manage Your Rule

Use the Rules area to manage your rules. You can create and delete rules, organize them into folders, and into a tree. Use these attributes for each rule.

Attribute Description
Enabled If you disable the rule, then Configurator won't apply it to your model.
Status

Contains one of:

  • Modified. You edited the rule text or modified one of rule's attributes since the last time you compiled the rule.
  • Error. There's an error that's preventing Configurator form compiling the rule.
  • Valid. You can compile and test the rule.
End Date If you set the end date for an object that the rule references, then the End Date attribute displays that object's end date. You can't modify the End Date attribute on the Rules tab, but you can modify the object's end date, and the End Date on the Rules tab will display your modified date.