How to Get Financial Dimensions for a particular Customer using X++ code in Ax 2012

TWO Ways:

Way 1:

static void GetFinancialDimensionValue(Args _args)
{
CustTable custTable ;
DimensionAttributeValueSet DimensionAttributeValueSet;
DimensionAttributeValueSetItem DimensionAttributeValueSetItem;
DimensionAttributeValue DimensionAttributeValue;
DimensionAttribute DimensionAttribute;

while select * from custTable
where custTable .AccountNum == “CU0000001″
join RecId from DimensionAttributeValueSet
where DimensionAttributeValueSet.RecId == custTable .DefaultDimension
join RecId, DisplayValue from DimensionAttributeValueSetItem
where DimensionAttributeValueSetItem.DimensionAttributeValueSet == DimensionAttributeValueSet.RecId
join RecId from DimensionAttributeValue
where DimensionAttributeValue.RecId == DimensionAttributeValueSetItem.DimensionAttributeValue
join RecId, Name from DimensionAttribute
where DimensionAttribute.RecId == DimensionAttributeValue.DimensionAttribute
{
info(DimensionAttribute.Name+”—-“+ DimensionAttributeValueSetItem.DisplayValue);
}
}

Way 2:

static void GetFinancialDimensionValue1(Args _args)
{
CustTable custTable = CustTable::find(“CU0000001”);
DimensionAttributeValueSetStorage dimStorage;
Counter i;

dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);

for (i=1 ; i<= dimStorage.elements() ; i++)
{

//if you want particular Dimension then put if condition like this
//if(strFmt(“%1″,DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name)==”Specialty”)
// {
info(strFmt(“%1 = %2”, DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,
dimStorage.getDisplayValueByIndex(i)));
//}
}

}

 

Advertisements