Skip to main content

Posts

Showing posts with the label value

Dynamics Ax Query Extended Range Value Expression

In this article we will see how to define extended query ranges using expressions. These expressions can be used in any query where you need to express a range that is more complex than is possible with the usual range value notations. The rules for creating query range value expressions are: Enclose the whole expression in parentheses. Enclose all subexpressions in parentheses. Use the relational and logical operators available in X++. Only use field names from the range's data source. Use the dataSource.field notation for fields from other data sources in the query. Values must be constants in the expression, so any function or outside variable must be calculated before the expression is evaluated by the query. This is typically done by using the strFmt function. Let's do it with some examples: OR clause on same field: Query q; QueryBuildDataSource qbd; QueryBuildRange qbr; q = new Query(); qbd = q.addDataSource(TableNum(CustTable)); q...

Ax2009 How to get Enum Label

dictEnum = new dictEnum(dictionary.enumName2Id('ENUMNAME')); info(strfmt("Enum Label: %1", dictEnum.label() )); info(strfmt("Enum item Lable:%1", dictEnum.value2Label(VALUE) ));

Getting a value from a field if you only know the field ID

static void Job4 ( Args _args ) { CustTable custTable; FieldId fieldId; ; fieldId = fieldNum ( CustTable , AccountNum ) ; // This could be passed as a method parameter select custTable; // Get first record print custTable. ( fieldId ) ; // Print account number select custTable where custTable. ( fieldId ) == '1101' ; // Where clause based on field ID print custTable. Name ; pause ; }