Please enable JavaScript to view this site.

Default values for parameters come in different shapes. The most basic form is that the default value is defined directly on the parameter, and the value is set immediately on creation of a configuration. Another form of default values are those that are set as a consequence of another parameter's value and these default values are set up using template rules.

A higher level of complexity are default values that are calculated. The triggers and calculations are set up using template expression rules and these often use parameters on a hidden tab to discover when any of the driving parameters have changed.

Example

Imagine that you are a manufacturer of elevators. For building of the elevator shaft you must know the distance between each landing (floor). Often this value can be calculated as the distance between the bottom and the top floor divided by the number of floors minus one. But the user must be able to fine tune the distances if needed.

Assumptions

The Elevator product contains a child product Landing that during configuration represents each floor that the elevator shall stop at.

Landing configurations are created automatically by 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 configurations.

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

The challenge is to calculate TravelFromPreviousLanding when TotalTravel or NumberOfLandings have changed and thereafter allow the user to change the value.

Solution

The CPQ architect has for the Landing product created a template expression rule that is triggered by changes in TotalTravel and NumberOfLandings. To identify these changes two parameters CalcForTotalTravel and CalcForNumberOfLandings have been added to a hidden tab.

The template expression rule is set up as below:

Setting name

Value

Trigger continuously

Checked

Inclusion expression

TotalTravel != CalcForTotalTravel || NumberOfLandings != CalcForNumberOfLandings

Parameter expression 1, sets the parameter CalcForTotalTravel

TotalTravel

Parameter expression 2, sets the parameter CalcForNumberOfLandings

NumberOfLandings

Parameter expression 3, sets the parameter TravelFromPreviousLanding

TotalTravel div (NumberOfLandings - 1)

 
The inclusion expression is triggered every time that that TotalTravel or NumberLandings is't equal to the values saved in CalcForTotalTravel and CalcForNumberOfLandings.

When the rule executes it first saves the new values of TotalTravel and NumberOfLandings and then calculates the value of TravelFromPreviousLanding. The calculation is done using integer division.

In a real example manual changes of TravelFromPreviousLanding should be handled so that the integrity with TotalTravel is kept, but that is not taken care of in this simplified example. Also, 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