In cumulative update 6 for Dynamics AX 2012 R2 we are introducing a new concept
called Calculations in the Constraintbased product configuration models.
Calculations have many similarities with constraints in the way they are
created and maintained, but constraints are focused on limiting the number of
possible combinations and Calculations to enable mathematical expressions. One other
important difference between Constraints and Calculations is that Calculations
can work with decimal numbers. So for instance if the cable length for a home
theater system is decided by the room size it could be expressed as in the
screenshot 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 name
and a description to allow you to state the purpose of the Calculation.
Calculation expressions are unidirectional and the Target attribute receives the value
from 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 and
in expressions for other target attributes. The order of the calculations will
be determined accordingly.
The Calculation expression holds the logical or mathematical expression that
represents the Calculation. The expression syntax is similar to the syntax
available for expression constraints, but a wider range of operators are
available, such as the If operator shown in the example above. Also, both
decimal numbers and unbound integers can be used both as Target attributes and
in the Calculation expression. You can type the calculation expression yourself,
or build it using the new expression editor (Screenshot below). This is also a
new capability in CU6, and I will give a more detailed introduction in my next
post.
This enhancement makes it possible to manipulate decimal numbers at runtime during
configuration; you no longer need to express this type of operation through the
dedicated application programming interface represented by the PCAdaptor class.
In the screenshot above, the Target attribute is of type decimal number and it can be
used as a property on a bill of material (BOM) line or a route operation, but
it cannot be included in a constraint or a condition. If you want to control
the inclusion of a certain BOM line or route operation, this can be achieved by
using a Target attribute of type Boolean and then using the Target attribute in
the 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 the
widthAttribute is greater than the lengthAttribute and false if it is equal to
or smaller than lengthAttribute. The BOM line condition will include the BOM
line only if the calculation returns true, whereas the route operation will
only be included if the calculation returns false.
The introduction of the Calculation concept means that an attribute can get its
value set by four different sources:
 User, value entered by the user during the configuration
 Default, value set in the product model
 Calculation, value resulting from a calculation expression
 Constraint, value set by a constraint
In the matrix below the rows state, which input sources have the ability to overwrite
an existing attribute value. Overwriting a value set by a constraint would result
in a model, which is in contradiction, and thus the configuration cannot be
finished 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? 

User 
Default 
Calculation 
Constraint 

Can 
User 

Yes 
Yes 
Yes * 
Default 
No 

Yes 
Yes * 

Calculation 
No 
No 

Yes * 

Constraint 
No 
No 
No 

Can the calculation be used to build the Sales price and cost price of individual BOM that is being built during the configuration process
Thanks.
A calculation takes the result from the calculation expression and returns it to the target attribute. This attribute can be used in conditions on both BOM lines and route operations to control the inclusion in the configured variant, and also to control one or more properties on both BOM lines and route operations.
So a calculation can impact both the cost and sales Price of a configuration, but the Price is calculated using the standard AX BOM calculation.
I am looking for a way to concatenate two fixed text values. Any ideas? (The ultimate goal is to string together several attributes and then use that string to be the item number.
Hi Ryner  any luck with that? I got the same thing on my list, use the attribute values in order to create an item number, example: attribute A= A09P, attribute B = 99. Calculated key has format “A+” “+”“+” “+B”, so the key value is A09P  99.
Appreciate your feedback,
cheers,
Falk
Hi Ryner and Peter
The Calculations concept does not have operators for text manipulation, for example concatinating text strings.
Thanks,
Sverre
Hi Peter,
In this case we had some freedom around item numbers and so created a new set of numeric item numbers, then used calculations to add values where the position in the numeric determined the item. The thousands for type, the hundreds for shape, tens for weight, etc. Adding them all together emulated concatenation and it worked for our purposes, but I look forward to the day when AX adds in Concatenation. It will be popular!
Hi Ryner
Thank you for the input!
In your view, what would be the best way to introduce Concatenation and possibly other text operators?
Include them in the calculation operator set, add a new modeling concept beside the existing constraints and calculations, something else?
Thanks,
Sverre
Sverre, my tuppence input: I suspect that it would be more intuitive for your average enduser to have a different set of operators when text type attributes are being evaluated.
Thanks for this and other invaluable blogs!
Hi Nicholas
Thank you for your input and kind words!
A different operator set. Does that imply a new modeling concept (in addition to Constraint and Calculation)?
Hi Sverre,
Is there a way to import the product configuration data using the DMF or an other tool
Thanks!
Hi Yahia
The Product configurator has it's own export/import feature, which includes all product model data, e.g. components, attributes, constraints, calculations, ...
Is this what you are looking for?
Thanks,
Sverre