25 October 2016

how to get Dimension Value using Default dimension in AX 2012

Option 1:

DimensionAttributeValueSetStorage    dimStorage;
str dimval;

dimval = DimensionAttributeValueSetStorage::find(salesQuotationTable.DefaultDimension).getDisplayValueByIndex(2);
info(strFmt("%1",dimval));

Option 2:

public void financialDimValue(Name _attributeName)
{
    DimensionAttributeValueSet          ceDimensionAttributeValueSet;
    DimensionAttributeValueSetItem      ceDimensionAttributeValueSetItem;
    DimensionAttributeValue             ceDimensionAttributeValue;
    DimensionAttribute                  ceDimensionAttribute;
    ;

    select RecId from ceDimensionAttributeValueSet
        where  ceDimensionAttributeValueSet.RecId == salesQuotationTable.DefaultDimension
    join RecId, DisplayValue from ceDimensionAttributeValueSetItem
        where ceDimensionAttributeValueSetItem.DimensionAttributeValueSet == ceDimensionAttributeValueSet.RecId
    join RecId from ceDimensionAttributeValue
        where ceDimensionAttributeValue.RecId == ceDimensionAttributeValueSetItem.DimensionAttributeValue
    join RecId, Name from ceDimensionAttribute
        where ceDimensionAttribute.RecId == ceDimensionAttributeValue.DimensionAttribute
        && ceDimensionAttribute.Name == _attributeName;

    inventSite          =   InventSite::find(ceDimensionAttributeValueSetItem.DisplayValue);
}

1 comment:

Give me the commetns and solutions

How to add the Display method in the form level in D365 F&O

 The below examle is to add the form -Data source level adding display method and assigning to form design control.