Bojensen Blogs

Custom Lookup for Dimensions in AX 2012 – for User Defined Dimensions | Santosh Kumar Paruvella’s Blog


In this article, giving an example for defining the lookup for dimensions in simple way.

This example will cover only for user Defined dimensions.

For this

1)      Created a form and added two string controls.

2)      Named as

Control: Name: Dimensionlist, Auto declaration – Yes

Control: Name: DimValues

3)      Override the lookup method for Dimensionlist

public void lookup() { Query query; SysTableLookup sysTableLookup; super(); sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionAttribute), this); sysTableLookup.addLookupfield(fieldNum(DimensionAttribute, Name)); query = new Query(); query.addDataSource(tableNum(DimensionAttribute)). addRange(fieldNum(DimensionAttribute, Type)). value(queryValue(DimensionAttributeType::CustomList)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); }

4)      Override the lookup method for DimValues

public void lookup() { DimensionAttribute dimensionAttribute; DimensionAttributeDirCategory dimAttributeDirCategory; Query query = new Query(); SysTableLookup sysTableLookup; dimensionAttribute = DimensionAttribute::findByName(Dimensionlist.text()); super(); // Only user defined dimensions will have a financial tag category if (dimensionAttribute.Type == DimensionAttributeType::CustomList) { select firstonly DirCategory from dimAttributeDirCategory where dimAttributeDirCategory.DimensionAttribute == dimensionAttribute.RecId; sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionFinancialTag), this); // Add name field to be shown in the lookup form. sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value)); sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description)); query = new Query(); query.addDataSource(tableNum(DimensionFinancialTag)). addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory)). value(queryValue(dimAttributeDirCategory.DirCategory)); sysTableLookup.parmQuery(query); // Perform the lookup. sysTableLookup.performFormLookup(); } }


Dim list

Dim Values

We can use the same concepts for Dimension controls on Ax 2012 SSRS reports dialog. To build the report dialog UI with dimension controls.

Custom Lookup for Dimensions in AX 2012 – for User Defined Dimensions | Santosh Kumar Paruvella’s Blog

Comments are closed.