How to: Display individual financial dimension value in grid control

To display inventory dimensions in the grid we have control of dimension display which can be set up as per the requirement. 
But there is no control in D365FO to display financial dimensions in grid control. 
There are 2 ways it can be done. 

1. Create display methods to display particular financial dimensions like the below method which displays division. I have seen many examples on the internet using multiple find methods but I prefer it by doing one query with joins to improve performance issues.

public display DimensionValue getDimensionDivision()
{
        DimensionAttributeValueSetItem  dimensionAttributeValueSetItem;
        DimensionAttributeValue              dimensionAttributeValue;
        DimensionAttribute                       dimensionAttribute;
     
        select DisplayValue from dimensionAttributeValueSetItem
            join dimensionAttributeValue
            join dimensionAttribute
            where dimensionAttributeValueSetItem.DimensionAttributeValue    == dimensionAttributeValue.RecId 
                 && dimensionAttributeValue.DimensionAttribute                == dimensionAttribute.RecId
                 && dimensionAttribute.Name                                                == 'Division'
                 && dimensionAttributeValueSetItem.DimensionAttributeValueSet == this.DefaultDimension;;

       return dimensionAttributeValueSetItem.DisplayValue;
}

You can replace Division with whatever financial dimension you want to display.

2. The problem with the display method even with query is performance is never good so to solve that use views to display values using SQL rather than X++.

Create a view in AOT as below:
DimensionViewForDivision is the first view created which can be used across D365FO for any master table. The second view is where I connect DimensionViewForDivision with the Customer table.
Change the value in range for Name with FD you want.


The view can be used on a form, query or another view to display data in UI.


Hope this helps!



Comments

  1. I think hardcoding the division is not a good idea. You can change the name of dimensions or have different dimension names in different environment which is less likely but possible. Instead I would use the backing entity type and add it to the join

    ReplyDelete

Post a Comment

Popular posts from this blog

How to : get the Deep URL for a particular form with filter in Dynamics 365 Finance and Operations

How to: Solve issue when DVT script for service model MRApplicationService on machine XXX failed