Home > Dynamics Ax 2012, SSRS > Custom Lookup for Dimensions in AX 2012 – for User Defined Dimensions

Custom Lookup for Dimensions in AX 2012 – for User Defined Dimensions


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();

}

}

Run:

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.

 

Advertisements
Categories: Dynamics Ax 2012, SSRS
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: