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. |
|
Select an option according to a choice that your user makes. |
|
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.
Note
- 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.
- 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.
- 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.
- 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.
- Click Validate to make sure your code doesn't have any errors that will prevent Configurator from compiling it, such as syntax errors.
- 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:
|
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. |