Price/Discount setup (form)

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

Click Product information management > Common > Product builder > Product models. Select a product model, and then click Setup > Price combinations. Press CTRL+N to create a new line and enter a description in the Description field. Click Price/Discount setup.

Use this form to create a logical expression, or rule, which determines when price combinations are valid for amount-based and percentage-based price adjustments. For calculated price adjustments, you can construct a mathematical expression (formula) that yields the actual price adjustment, expressed in the default currency. The procedure for creating price adjustment expressions is the same as that for validation rules. For more information, see About validation rules.

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

Tabs

Tab

Description

Overview

Create an expression that consists of an operand—either a fixed value or variable for a product model—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' when an item is configured.

Code

Write an expression in X++ code directly.

Buttons

Button

Description

Validate price combination

Test the syntax of an expression.

Transfer to program code

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

Note

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

Fields

Field

Description

Type

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

Text

Specify an operand in the logical expression that you are building. The operand can be either a fixed value or a modeling variable for a product model, depending on your selection in the Type field. If you specify a modeling variable that is an array, you must also specify the array index in the Index field.

When the Type field is set to Variable, you can select variables in the Text field.

Note

If the Type field is set to Value, you must consider the data type of the values that you enter. Text values must be enclosed in single quotation marks ('). Otherwise, the compiler interprets the text as a variable name, and a compilation error is displayed when the rule is validated. However, numeric values should not be enclosed in quotation marks.

Index

Specify the array index if the following conditions are true:

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

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

Note

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

Operator

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

Code

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 Overview tab and then transfer it to the Code tab.

When you modify an expression on the Code 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 a variable for a product model, 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.

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

Set up price combinations

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