Calculations for product configuration models [AX 2012]

Updated: June 21, 2013

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2

This topic describes calculations for product configuration models and how to use calculations together with constraints. You can define calculations in the Constraint-based product configuration model details form and then build expressions for the calculations in the expression editor. For more information, see Create calculations.

A calculation is an element that you can use in a configuration model. Calculations complement constraints by enabling you to calculate values by using decimal numbers when you configure a product. Furthermore, calculations have a larger set of operators available than constraints do. Like a constraint, a calculation is associated with a specific component in a product configuration model and it can’t be reused by or shared with another component. For more information about constraints, see Expression constraints and table constraints.

A calculation consists of a target attribute and a calculation expression.

A target attribute is an attribute that receives the result of the calculation in an expression.

In the following expression, the target attribute is a tablecloth measurement:

Expression: If[(decimalAttribute1 / decimalAttribute2) < 1, True, False]

DecimalAttribute1 is the table length and decimalAttribute2 is the tablecloth length. The expression returns the value “True” to the target attribute if decimalAttribute2 is greater than or equal to decimalAttribute1, and “False” if it’s not. So the tablecloth measurement is acceptable if the tablecloth length is equal to or exceeds the length of the table.

All attribute types that are supported for the product configurator can be set to target attributes except for text without a fixed list.

No, the value for a target can’t restrict the values for the input attributes. Calculations are unidirectional. The value of the target attribute is set based on changes to the value of the input attributes. However, changing the value of the target doesn’t impact the value of the input attributes. This is contrary to how constraints work. In constraints, the calculation occurs in both directions.

Example

In the following expression, the target for the calculation is the length of a power cord and the input value is a color. If you select the input value Green as the color of the power cord, the length is set to 1.5. For other colors, the length is 1.0.

Expression: [If Color == “Green”, 1.5, 1.0]

When you configure the item, the calculation generates 1.5 as the length of the power cord if you specify Green as the color attribute. If you specify any other color, the length is 1.0. However, because calculations are unidirectional, the calculation does not set the value of the color attribute to Green when you specify a length of 1.5.

The result of the calculation returns only the integer part of the calculation. The decimal part is removed and the result is not rounded. For example, the result of 12.70 is shown as 12.

Calculations occur when a value has been provided for all input attributes.

You can overwrite the value that is calculated for the target attribute unless the target attribute is set as hidden or read-only.

To set an attribute as hidden or read-only, follow these steps:

  1. Click Product information management > Common > Product configuration models.

  2. Select a product configuration model. On the Action Pane, click Edit.

  3. In the Constraint-based product configuration model details form, select the attribute to use as a target attribute.

  4. On the Attributes FastTab, select Hidden or Read-only.

No. The values that you set when you configure a product are the values that are used. The calculation that occurs when the input values in a calculation are changed can’t overwrite the values that you provide for a specific attribute.

If you remove an input value in a calculation, the value of the target attribute is also removed.

This message is displayed when a calculation includes an error or a contradiction exists in one or more constraints. For more information about contradictions in constraints, see Expression constraints and table constraints. Errors in calculations can, for example, occur in the following situations:

  • A value is divided by zero.

  • A conflict exists between these two elements:

    • The values that are available for an attribute and that are limited by a constraint.

    • A value that is generated by a calculation.

  • The values that are returned by the calculation are outside the domain of the attribute. An example is an integer from [1..10] that is calculated to 0.

Calculations are not included in the validation. You must test the product configuration model to find errors in calculations.

The following steps explain how to test a product configuration model:

  • Click Product information management > Common > Product configuration models.

  • Select a product configuration model. On the Action Pane, in the Run group, click Test.

We're working to include as many questions as we can, so that Microsoft Dynamics AX Help will be more useful to people just like you.

Tell us what question you would like to add to this topic. Send email to adocs@microsoft.com.


Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).

Community Additions

ADD
Show: