Please enable JavaScript to view this site.

Default values for parameters come in different forms. The most basic form is a default value defined directly on the parameter, which is set immediately upon creating a configuration. Another form includes default values that are set as a consequence of another parameter's value; these default values are configured using assignment rules.

A higher level of complexity involves default values that are calculated. The triggers and calculations for these are configured using assignment expression rules, which often utilize parameters on a hidden tab to detect when any of the driving parameters have changed.

Example

Imagine that you are a manufacturer of elevators. To construct the elevator shaft, you must know the distance between each landing (floor). Often, this value can be calculated as the total distance between the bottom and top floors, divided by the number of floors minus one. However, the user must still be able to fine-tune these individual distances if needed.

Assumptions

The Elevator product contains a child product, Landing, which represents each floor where the elevator stops during a configuration session.

Landing configurations are created automatically using dynamic instances driven by the integer parameter NumberOfLandings.

The travel distance from the bottom landing to the top landing is set by the integer parameter TotalTravel.

The values of TotalTravel and NumberOfLandings are propagated from the Elevator configuration to each Landing configuration.

The travel distance up to a landing from the landing below is set by the integer parameter TravelFromPreviousLandning.

The challenge is to calculate TravelFromPreviousLanding whenever TotalTravel or NumberOfLandings changes, while still allowing the user to manually overwrite the calculated value afterward.

Solution

The CPQ architect has created an assignment expression rule for the Landing product that is triggered by changes in TotalTravel and NumberOfLandings. To detect these changes, two helper parameters, StoredTotalTravel and StoredNumberOfLandings, have been added to a hidden tab.

The assignment expression rule is configured as follows:

Setting name

Value

Trigger continuously

Checked

Inclusion expression

TotalTravel != CalcForTotalTravel || NumberOfLandings != CalcForNumberOfLandings

Parameter expression 1, sets the parameter StoredTotalTravel

TotalTravel

Parameter expression 2, sets the parameter StoredNumberOfLandings

NumberOfLandings

Parameter expression 3, sets the parameter TravelFromPreviousLanding

TotalTravel div (NumberOfLandings - 1)

 
The trigger expression fires every time TotalTravel or NumberOfLandings does not equal the values currently saved in StoredTotalTravel and StoredNumberOfLandings.

When the rule executes, it first saves the new values of TotalTravel and NumberOfLandings to the helper parameters, and then calculates the value of TravelFromPreviousLanding. The calculation is performed using integer division (div).

Note! In a production scenario, manual changes to TravelFromPreviousLanding should be managed to maintain integrity with TotalTravel, but that is omitted from this simplified example. Additionally, TravelFromPreviousLanding should be hidden at the bottom landing.

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC