Use this form in amount-based and percentage-based price adjustments to create the logical expression, or rule, that decides when the price combination will be valid. For calculated price adjustments, this form is used to construct a mathematical expression (formula) that yields the actual price adjustment, expressed in the system's default currency. The procedure for creating price adjustment expressions is the same as that for validation rules. See Validation rulesfor a detailed description.

Navigating the form

The following tables provide descriptions for the controls in this form.

Tabs

Tab

Description

Create an expression that consists of an operand – either a fixed value or one of your product model's modeling variables – and an optional operator. Expressions are evaluated according to the normal rules of operator precedence.

For amount-based and percentage-based price adjustments, the price combination becomes effective if the expression evaluates to 'true' during item configuration.

Use this tab to write the expression in X++ code directly.

Buttons

Button

Description

Test the syntax of your expression.

Transfer an expression from the tab to the tab to work with it directly as X++ code.

Note Note

If the field is not empty, whatever it contains will be the active version of the expression, regardless of what you enter on the tab. Therefore, if you want to revert to editing the expression on the tab, you must delete the contents of the field.


Fields

Field

Description

Select whether the operand specified in the field is a fixed value or a variable.

Specify an operand in the logical expression that you are building. The operand can be either a fixed value or one of your product model's modeling variables, depending on the choice made in the field. If you specify a modeling variable that is an array, you must also specify the array index in the field.

When the field is set to , you can obtain a list of available variables from the lookup fields in the field.

NoteWhen the field is set to , you have to consider the data type of the values you enter. Text values must be enclosed in single quotation marks ('). Otherwise the compiler will interpret the text as a variable name, and you will receive a compilation error when the rule is being validated. However, numeric values should not be enclosed in quotation marks.

Specify the array index if the following conditions are true:

  • The operand in this line is a variable, as you selected in the field.

  • The variable that you specified in the field is an array.

NoteThe array index is the position number of the specific array element that is relevant for the current expression.

Specify an operator that connects the current line with the next line to form a logical expression. The following operators are available and are listed in the order of operator precedence:

* /

multiplication, division

+ -

plus, minus

> < >= <=

greater than, less than, greater or equal, less or equal

= !=

equal, not equal

and or

logical and/or

Write the expression in X++ code directly. The expression must be formed as an X++ method that returns an integer value (for amount-based and percentage-based adjustments) or a value of the type real (for calculated adjustments). To see how this basic syntax works, you can create an expression on the tab and then transfer it to the tab.

When you edit an expression on the tab, you can make it as sophisticated as you like by using all the tools of X++ language of Microsoft Dynamics AX. For a description of the X++ language, see the Microsoft Dynamics AX Developer's Guide.

To reference one of your product model's variables, use the following syntax, varMap ('variable_name',array_index), where variable_name is the name of the variable and array_index is the index of the array element you want.

Note Note

The first element is always indexed as 1, even when no other elements exist.


For example, to reference a variable called c_doors that is not an array variable, you should type it as varMap('c_doors',1)

See Also