Find Active Dimensions for a Legal Entity [Ax2012]

This article focuses on getting the active dimensions for a Legal Entity. In Ax 2009, we could get the number of dimensions by using the enumCnt method on SysDimension enum and get the count. Here it is not that straight forward.

Following job will help you in getting the count and display their names;

static void getActiveFinancialDimensions(Args _args)

{

    DimensionAttributeSetItem   dimAttrSetItem; // Contains the number of dimensions active for a account structure ledger

    DimensionAttribute          dimAttr; // Contains the financial dimensions records

    DimensionEnumeration        dimensionSetId; //Record id for table that contains active dimensions for current ledger

   

    int dimAttrCount;

   

    //Get the record Id (dimension set id) for current ledger to find active dimensions

    dimensionSetId = DimensionCache::getDimensionAttributeSetForLedger();

 

    //Find the count of active dimensions for current ledger except main account

    select count(RecId) from dimAttr

            where dimAttr.Type != DimensionAttributeType::MainAccount

        join RecId from dimAttrSetItem

            where dimAttrSetItem.DimensionAttribute == dimAttr.RecId &&

                dimAttrSetItem.DimensionAttributeSet == dimensionSetId;

   

    info(strFmt("Total active financial dimensions for current legal entity: %1", dimAttr.RecId));

               

    //Find all the active dimensions for current ledger except main account and display them

    while select * from dimAttr

        order by Name

            where dimAttr.Type != DimensionAttributeType::MainAccount

        join RecId from dimAttrSetItem

            where dimAttrSetItem.DimensionAttribute == dimAttr.RecId &&

                dimAttrSetItem.DimensionAttributeSet == dimensionSetId

    {

        info(dimAttr.Name);

    }

}

image

9 thoughts on “Find Active Dimensions for a Legal Entity [Ax2012]

    1. By the way.. if you are looking at making it mandatory for the entire company, there is an option while setting up the account structures. When you setup account structures, dont allow blank values So when you create any transaction, it wil be mandatory to provide a value to the dimension

  1. hello…
    please can you tell me how to apply record level security key Funtionality in ax 2009 . when i am applying RLS it is takeing usergroup vice,in the query form when i am select perticuler user it is showing , in the criteria option if i select giving rang 5 ,6 emplys it is showing data to the all usergoup person . can you tall me funtionality how can i apply for per perticuler user only.

  2. Hello!
    Suppose I have account structure AS1 for MainAccount = 4. Both AS are active. AS1 contains MainAccount, Department and CostCenter, and AS2 contains MainAccount and Employee (to simplify things).
    In a SegmentedEntry control corresponding to a ledger dimension, if I fill in the main account with value 7, the control will “know”” that the corresponding AS is AS2, and show the correct segments (Employee).

    DimensionCache::getDimensionAttributeSetForLedger() allways returns AS1, which is logic as there is no parameter related to the MainAccount to differentiate by.

    My question is: how can I get the corresponding AS for a certain DimensionAttributeValueCombination?

    Thank you.
    Carmen P.

  3. For some reason, my message was truncated. I originally wrote:
    …..
    AS1 for MainAccount up to 4 and AS2 for MainAccount above 4.
    ….

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