web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

How to get all Dimension Names and Values from Default Dimensions - D365FO X++

Bharani Preetham Peraka Profile Picture Bharani Preetham Pe... 3,634 Moderator
Sometimes we need to retrieve all the dimensions from the dimension reference field which we have in our tables.

Here is a generic logic which gets all the dimensions for the particular order or may be any table. Lets say Sales Order or Customers or Vendors table or some Journal related tables. 

This simple method needs the default dimension as the parameter and returns us Dimension Names and its Values.

Currently the dimNames and dimValues are the container type variables defined globally in class as I have a different requirement.

private void getDimensions(DimensionDefault _defaultDimension)
{
    DimensionAttributeValueSetItem  setItem;
    DimensionAttributeValue         dimAttrValue;
    DimensionAttribute dimAttr;

    dimNames = conNull();
    dimValues = conNull();

    while select DisplayValue from setItem
        where setItem.DimensionAttributeValueSet == _defaultDimension
        join dimAttrValue
            where dimAttrValue.RecId == setItem.DimensionAttributeValue &&
            dimAttrValue.IsDeleted == false
        join Name from dimAttr
        where dimAttr.RecId == dimAttrValue.DimensionAttribute
    {
        dimNames += dimAttr.Name;
        dimValues += setItem.DisplayValue;
    }
}



Happy Learning!

Comments