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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

X++ code to display dimension values for a given dimension in D365FO.

Chaitanya Golla Profile Picture Chaitanya Golla 17,225

Hi,

In this post will provide the code to display the financial dimensions of a given party. For demo purpose chosen a vendor.

Below are the financial dimensions of a vendor:

1538.VendorDimensions.jpg

X code:

class DAX_FinDimensionsDisplay
{        
    /// 
    /// Runs the class with the specified arguments.
    /// 
    /// The specified arguments.
    public static void main(Args _args)
    {        
        DimensionAttributeValueSetStorage dimStorage;
        str								  name;
        VendTable						  vendTable;
        int								  i = 1;	

        select * from vendTable
            where vendTable.AccountNum == "1001";

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

        while (i<= dimStorage.elements())
        {
            name = DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name;

            info(strFmt("Name: %1, Value: %2", name, dimStorage.getDisplayValueByIndex(i)));
			
			i  ;
        }
        
    }

}

On executing the above code, dimension values get displayed.

2313.Output.jpg

Regards,

Chaitanya Golla

Comments

*This post is locked for comments