In cumulative update 6 for Dynamics AX 2012 R2 we are introducing a new conceptcalled Calculations in the Constraint-based product configuration models.Calculations have many similarities with constraints in the way they arecreated and maintained, but constraints are focused on limiting the number ofpossible combinations and Calculations to enable mathematical expressions. One otherimportant difference between Constraints and Calculations is that Calculationscan work with decimal numbers. So for instance if the cable length for a hometheater system is decided by the room size it could be expressed as in thescreenshot example below.
If[ RoomSize / 1.33 > 7.5, 3.33, 6.66]
The image below shows how Calculations are defined for a product configuration model.
A Calculation, much like other product configuration model concepts, has a nameand a description to allow you to state the purpose of the Calculation.
Calculation expressions are uni-directional and the Target attribute receives the valuefrom the expression. The attributes can not be of type free text.
(It is possible to use a Text with a fixed list, also known as an Enumeration, but for a Target attribute of this type the return vale has to be the Integer order of the text value in the text list)
An attribute can both be used as a target attribute andin expressions for other target attributes. The order of the calculations willbe determined accordingly.
The Calculation expression holds the logical or mathematical expression thatrepresents the Calculation. The expression syntax is similar to the syntaxavailable for expression constraints, but a wider range of operators areavailable, such as the If operator shown in the example above. Also, bothdecimal numbers and unbound integers can be used both as Target attributes andin the Calculation expression. You can type the calculation expression yourself,or build it using the new expression editor (Screenshot below). This is also anew capability in CU6, and I will give a more detailed introduction in my nextpost.
This enhancement makes it possible to manipulate decimal numbers at run-time duringconfiguration; you no longer need to express this type of operation through thededicated application programming interface represented by the PCAdaptor class.
In the screenshot above, the Target attribute is of type decimal number and it can beused as a property on a bill of material (BOM) line or a route operation, butit cannot be included in a constraint or a condition. If you want to controlthe inclusion of a certain BOM line or route operation, this can be achieved byusing a Target attribute of type Boolean and then using the Target attribute inthe condition on the BOM line or route operation. Please see example below:
Target attribute: widthLengthRatioBoolean
Calculation: widthAttribute > lengthAttribute
BOM line condition: widthLengthRatioBoolean
Route operation condition: !widthLengthRatioBoolean
In this example the widthLengthRatioBoolean attribute takes the value true if thewidthAttribute is greater than the lengthAttribute and false if it is equal toor smaller than lengthAttribute. The BOM line condition will include the BOMline only if the calculation returns true, whereas the route operation willonly be included if the calculation returns false.
The introduction of the Calculation concept means that an attribute can get itsvalue set by four different sources:
In the matrix below the rows state, which input sources have the ability to overwritean existing attribute value. Overwriting a value set by a constraint would resultin a model, which is in contradiction, and thus the configuration cannot befinished and saved. This is indicated by the * in the Constraint column cells.
So one example here is that a calculation can overwrite a value set by a constraint,but then the configuration cannot be saved.
Input order matrix
Can be overwritten?