Hi Friends,
Today we will be exploring the new changes related to Financial dimensions in AX 2012.
In earlier version, accessing dimension values was very simple like
CustTable.Dimension[0] == Department value
CustTable.Dimension[1] == CostCenter value
CustTable.Dimension[2] == Purpose value
In AX 60, since they have replaced Dimension EDT with RecId DimensionDefault we have to make use of Dimension helper classes to access values.So in CustTable you will find defaultDimension field which stores reference recId for DimensionAttributeSet.
I am referring Customer 1101 in CEU Company, Contoso Demo Data for illustration purpose. Note the dimension values for this customer as shown in below snap.
Refer the code to access the values.
static void DEV_Dimension(Args _args)
{
CustTable custTable = CustTable::find("1101");
DimensionAttributeValueSetStorage dimStorage;
Counter i;
dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);
for (i=1 ; i<= dimStorage.elements() ; i++)
{
info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,
dimStorage.getDisplayValueByIndex(i)));
}
}
When you run the job, will see as below
I know that now you might have understood the importance of theses helper classes, they are making our lives easy :)
Today we will be exploring the new changes related to Financial dimensions in AX 2012.
Earlier versions AX 2009, 4.0 :
- In older version System use to limit the creation of dimensions up to 10.
- By default 3 dimensions were available in the system namely Department, CostCenter and Purpose.
Technically these dimensions were controlled by Enum SysDimension and an array EDT Dimension. - So If we have 3 enum elements in SysDimension, then its corresponding array elements are stored in dimension EDT and can be referred as Dimension[0], Dimension[1].....
- If you would like to store these dimension values against customized table, then simply we were adding the EDT Dimension to that Table. At Form level simply drag and drop field on Group then system use to show all the array elements as string control.
- In AX 60, their is no limit to dimension creations. One can create n number of dimensions as per organization requirements.
- Technically their is huge change in framework, the way these dimensions used to be created and stored.
- Firstly EDT Dimension (array) is deprecated and replaced with DimensionDefault (Int64 RecId).
- Financial Dimensions master table Dimension is replaced with DimensionAttribute and DimensionValueDetails.
- Now if one wish to store these dimension on your customized table then instead of EDT Dimension one should add DimensionDefault EDT.
- At Form level make use of DimensionDefaultingController class to show the available dimensions.
In earlier version, accessing dimension values was very simple like
CustTable.Dimension[0] == Department value
CustTable.Dimension[1] == CostCenter value
CustTable.Dimension[2] == Purpose value
In AX 60, since they have replaced Dimension EDT with RecId DimensionDefault we have to make use of Dimension helper classes to access values.So in CustTable you will find defaultDimension field which stores reference recId for DimensionAttributeSet.
I am referring Customer 1101 in CEU Company, Contoso Demo Data for illustration purpose. Note the dimension values for this customer as shown in below snap.
Refer the code to access the values.
static void DEV_Dimension(Args _args)
{
CustTable custTable = CustTable::find("1101");
DimensionAttributeValueSetStorage dimStorage;
Counter i;
dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);
for (i=1 ; i<= dimStorage.elements() ; i++)
{
info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,
dimStorage.getDisplayValueByIndex(i)));
}
}
When you run the job, will see as below
I know that now you might have understood the importance of theses helper classes, they are making our lives easy :)
nice post. i have one question, how can i add filter on any particular dimension like if i want to filter on Department, in AX2009 i can refer it to as Dimension[1], but whats the way in AX2012
ReplyDeletenice post I kind of have the same question as sjafry, how can we filter on a particular dimension to display
ReplyDeleteThank you
Hi,
ReplyDeleteYou can use below views (AOT->DataDict->Views)
DimAttributeOMDepartment => Show only Departments
DimAttributeOMCostCenter => Show only CostCenter
DimAttributeOMBusinessUnit => Show only Purpose
Hi Nagaraj,
ReplyDeleteThanks for these useful information.
I want to know that if i need to filter CustInvoiceTrans table data based on dialog entry of type either costcenter or purpose or departement then what is the way in AX2012 ?
Hi Nagaraj,
ReplyDeleteHave you tried to setup the dimension properties across forms ?
i.e ( i need to make some dimensions on Customer form Mandatory while keep the same dim Not-Mandatory in Suppliers form).
Do I have to write some code in DimensionDefaultingController class ? or can i only do it from Application setup ?
thanks
khalid