Comergent
PREV NEXT INDEX

Fragments

As you create rules, you must create rule fragments that perform the rule logic. This section describes in detail how to create and work with rule fragments.

Working With Rule Fragments

Use these procedures to define or modify a rule's fragments when you are creating ( To Define a Rule) or modifying ( To Modify a Rule) a rule.

Click here for screen shot.

FIGURE 336. New Rule and Defining Fragments

When you are creating a rule, the Fragment area appears as in Figure 336.
TABLE 35. Rule Buttons 
Button
Name
New Operator button
New Fragment button
Delete button
Edit button

Click the New Fragment icon here to create a fragment at the currently displayed level (in this case, the top level) in the rule structure. Click New Fragment again to create a second fragment at the currently displayed level. In other words, the rule would be:

FragmentA AND FragmentB

Clicking the New Operator icon creates a nested level for creating fragments, as shown in Figure 337. The new level displays a new set of New Fragment and New Operator links. You use this New Fragment link to create the fragments at this nested level. If you click New Operator at this level, then you will create another nested level below this one with another set of New Fragment and New Operator links for that level.

Click here for screen shot.

FIGURE 337. New Rule Tab with Nested Levels

Example: To Create a Simple Level of Fragments

In this example, you are attempting to create a rule consisting of two fragments, joined by a single operator, with no nested levels: FragmentA AND FragmentB. When you access the tab, the New Rule tab appears as in Figure 338.

Click here for screen shot.

FIGURE 338. New Rule Tab for a Single-Level Rule

  1. Select the boolean operator you want for these fragments.
  2. Click the New Fragment icon

    This displays the New Fragment tab.

Click here for screen shot.

FIGURE 339. New Fragments Tab

  1. Define the fragment.
    1. Check the Not check box if you want to define the fragment as a negative: "NOT (sum(PropertyA <= 250))".
    2. Select the first function from the Function1 drop-down list.

      See Table 12, Function Definitions.

    3. Select a property from the Property1 drop-down list.
    4. Select the operator.

      See Table 13, Operators.

    5. Select the second function from the Function2 drop-down list.
    6. In the Property2 field, select a property from the drop-down list or enter a literal value in the field (if you selected "literal" as the function).
    7. Select the value for the If Not Specified drop-down list.

      See If Not Specified for an explanation of these values.

  2. Click Save and Return.

    This re-displays the New Rule tab with the new fragment, as shown in Figure 340. Also, notice the infix representation.

Click here for screen shot.

FIGURE 340. New Rule Tab with New Fragment

  1. Click the New Fragment icon to create the next fragment in the rule.
  2. Repeat Step 3 to define the second fragment.
  3. Click Save and Return.

    This re-displays the New Rule tab with the fragment you created, as shown in Figure 341. Notice that the rule has two fragments now.

You can click Save to save the rule and continue defining the rule. Click Save and Return to return to the list of rules in the Define tab.

Click here for screen shot.

FIGURE 341. New Rule Tab with Two New Fragments

Example: To Create Nested Fragments

In this example, the modeler is creating the following rule with nested fragments:

(FragmentA AND FragmentB) OR (FragmentC AND FragmentD)

Click here for screen shot.

FIGURE 342. New Rule Tab

  1. Click New Operator icon.

    A nested level appears in the New Rule tab, as shown in Figure 343. This level has its own drop-down boolean operators, as well as its own New Fragment, New Operator, and Delete Operator icons.

Click here for screen shot.

FIGURE 343. New Rule Tab with Nested Fragments

  1. Create two fragments as described in Example: To Create a Simple Level of Fragments.

    Use the nested drop-down list to select the boolean operator for these fragments. The default is AND.

    Use the nested New Fragment icon to create the fragments at this nested level.

    When the two fragments are completed, the New Rule tab appears as in Figure 344.

You can nest as many fragments as you want by clicking the nested New Operator icon. Each time, a new nested operator will appear with a new set of nested icons. You use these nested icons to create the fragments for the nested level.

Click here for screen shot.

FIGURE 344. New Rule Tab with Nested Fragments

  1. Using the top-level list, select the boolean operator (in this example, OR) that will join the two nested levels.

Click here for screen shot.

FIGURE 345. Nested Fragments with OR Boolean

  1. Click the New Operator icon at the top level.

    A new nested level appears in the fragments tab, as shown in Figure 346. This level has its own drop-down boolean operators, as well as its own New Fragment, New Operator, and Delete Operator icons.

Click here for screen shot.

FIGURE 346. Nested Fragments

  1. Create two fragments as described in Example: To Create a Simple Level of Fragments.

    Use the nested drop-down list of boolean operators and the nested New Fragment icon for these fragments.

    When the two fragments are completed, the New Rule tab appears as in Figure 347.

Click here for screen shot.

FIGURE 347. Two Nested Fragments Joined by OR

To Modify a Fragment

  1. Find the fragment you want to modify, then click on the Edit Fragment icon in the Actions column.

    This displays the Edit Fragment tab.

Click here for screen shot.

FIGURE 348. Edit Fragment Tab

  1. Modify one or more elements of the fragment.
    1. Check the Not check box if you want to define the fragment as a negative: "NOT (sum(PropertyA <= 250))".
    2. Select the first function from the Function1 drop-down list.

      See Table 12, Function Definitions.

    3. Select a property from the Property1 drop-down list.
    4. Select the operator.
    5. See Table 13, Operators.
    6. Select the second function from the Function2 drop-down list.
    7. In the Property2 field, select a property from the drop-down list or enter a literal value in the field (if you selected "literal" as the function).
    8. Select the value for the If Not Specified drop-down list.

      See If Not Specified for an explanation of these values.

  2. Click Save And Return.

To Delete a Fragment

Find the fragment you want to delete in the Fragments table, then click the Delete icon in the Actions column on the same line as the fragment.

Working with Rule Actions

Perform these tasks when you want to include a rule action when you are creating ( To Define a Rule) or modifying ( To Modify a Rule) a rule.

You define rule actions in the lower part of the New Rule or Edit Rule tab. Rule actions comprise three types of actions:

Click here for screen shot.

FIGURE 349. New Rule Tab Showing Action Area

To Create a Message Action

When you are creating ( To Define a Rule) or modifying ( To Modify a Rule) a rule, you perform this task in the Message Actions area of the New Rule or Edit Rule tab.

  1. Select the type of message action from the drop-down list: Error, Warning, Suggestion.
  2. Type the message.
  3. Click Add Item.
  4. Repeat these steps to enter additional messages.
  5. Click Save to save the message action and continue editing. Click Save and Return to save the message and return to the Define tab.

Click here for screen shot.

FIGURE 350. Edit Rule Tab with Message Action

To Create an Expansion Action

When you are creating ( To Define a Rule) or modifying ( To Modify a Rule) a rule, you perform this task in the Expansion Actions area of the New Rule or Edit Rule tab.

  1. Enter a formula. The formula can use the supported functions as described in Rule Fragments.

    The results of formula will be used to perform the expansion. See Expansion for an explanation of rule formulas.

Click here for screen shot.

FIGURE 351. Expansion Action

  1. Enter a minimum and a maximum amount of the formula result.

    The minimum amount is the minimum value the rule formula result must be greater than. This value can be negative or greater than or equal to zero. The value must be less than the maximum value (Max). The maximum amount is the maximum value the rule formula result must match. This value must be greater than the minimum value (Min).
    Note:
    Min and Max work slightly differently: for a fragment to evaluate to true, the rule formula must evaluate to greater than the Min value, but less than or equal to the Max value.

  2. Enter the quantity of the expansion items (must be greater than zero). You can use the supported functions to calculate the quantity and so you can specify the quantity as a function of a property. For example:

    2*value(Memory Cards)

  3. Enter the item that will be expanded.

    You must provide the full path to the expansion item within the current model. In the figure above, for example, the rule adds an option item called either 64MB, 128MB, or 256MB, located in option class AutoMemory in the current model.

Click here for screen shot.

FIGURE 352. Expansion Action With Example of Using Quantity Function

When a rule is used in multiple models, this fully qualified path could be difficult to specify since the current model name will very likely not be "MXWS-7650" for all the models where the rule is attached. To facilitate the use of expansion rules across multiple models, you can usual special symbols as follows:

  1. Repeat these steps to enter additional items.
  2. Click Save All Changes.

Typically, the result of an expansion action is to pick a quantity selected on an option item. If the option item quantity is a drop-down list, then you should take to ensure that the possible calculated values are consistent with the pickable values: otherwise, the drop-down list will not be able to display the calculated value.

To Create an Assignment Action

When you are creating ( To Define a Rule) or modifying ( To Modify a Rule) a rule, you perform this task in the Assignment Actions area at the bottom of the New Rule or Edit Rule tab.

Click here for screen shot.

FIGURE 353. Assignment Actions

  1. Select a property from the drop-down list. The table below summarizes some of the special properties that can be assigned.
  2. Enter a value for the property. You can use the supported functions to calculate the value and so you can specify the value as a function of a property. For example:

    2*value(Memory Cards)

    When you are assigning a value to a property whose type is String, then you must use the following syntax to refer to properties:

    ${function(arg1, arg2, ..., arg N}

    For example, ${expand("Color", "Black", 0)}. See Example Uses of Expand for other examples of the usage of the expand function.

  3. Type the entity to which you want to assign the property and its value.

    If you leave this field blank, then the assignment defaults to the entity to which the rule is attached.

  4. Click Add Item.

Click here for screen shot.

FIGURE 354. Assignment Action With Example of Using Quantity Function

  1. Repeat these steps to add additional items.
  2. Click Save All Changes.

The following table summarizes some of the available properties for assignment. These properties can be changed each release so check with your Comergent Technologies representative for further information if required.
TABLE 36. Assignment Action Properties
Property
Action
_constraintMessage
String: a message on an item because it is constrained
_constraintType
Integer: type of constraint; 0 is suggest, 1 is warn, and 2 is error
_description
String: an items description
_amEntitled
Integer: 0 false, 1 true
_isConstrained
Integer: 0 false, 1 true
_isSelected
Integer: 0 false, 1 true
_isViewable
Integer: 0 false, 1 true
_itemKey
Integer: database key of the item
_pickOverride
Integer: 0 false, 1 true; pick was overridden by a rule
_quantity
Integer: quantity; 0 quantities are not in the rule pool
_ratio
Numeric: ratio of this item to its children, computed if nested within another parent
_rawRatio
Numeric: raw ratio used in previous computation
_rulePick
Integer: 0 false, 1 true
_tabLevel
Integer: depth of this item

Example Uses of Expand

The syntax of the expand function should follow ${expand(property[,defaultValue[,format[,lookup]]])}.

For example, suppose that you want to display the name of the model as the name of the associated product together with the product description. Then at the model level, set the value of the UI: DISPLAY NAME property to: ${expand("UI: PRODUCT NAME")} or ${expand("UI: PRODUCT DESCRIPTION","Description not available")}.

This has the advantage that if the product name or description gets changed, then if you recompile the model, then the name or description is displayed with the new version when users next configure product.

Here are some further examples of the expand function:

PREV NEXT
Comergent Technologies
http://www.comergent.com
Voice: (650) 232 6000
Fax: (650) 232 6010
support@comergent.com
sales@comergent.com