Tuesday 25 November 2014

Financial Dimension values in Ax 2012


Hi Friends ,

In Ax Financial Dimensions are widely used. In Ax 2012 these dimensions are not at all individual fields, all these Financial dimensions are combined into a single field Default Dimension. This default dimension carry reference to a set of Financial dimension.

The question is how do we get single value of the dimension or all the set of values using this financial dimensions. Here is the sample code which gives the values of financial dimensions.

public static SysDim DefaultDimensionValue(DimensionDefault _dimensionDefault, Description _nameofDimension)
{

DimensionAttributeValueSetStorage dimensionStorage;
Counter i;
SysDim nameofDimension;


// Get dimension storage
if (_dimensionDefault)
{
dimensionStorage = DimensionAttributeValueSetStorage::find(_dimensionDefault);

for (i=1 ; i<= dimensionStorage.elements() ; i++)
{
if (DimensionAttribute::find(dimensionStorage.getAttributeByIndex(i)).Name == _nameofDimension)
{
nameofDimension= dimensionStorage.getDisplayValueByIndex(i);
break;
}
else
{
nameofDimension= '';
}
}
}

return nameofDimension;
}

The above sample code gives values dimension value if you have default dimesion and name of Dimension. If you want all the values just tweak this code a little bit.

Vivek Chirumamilla

No comments:

Post a Comment