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

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

  1. Pingback: How to Get Financial Dimensions for a particular Customer using X++ code in Ax 2012 - Microsoft Dynamics AX Community

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