Показать сообщение отдельно
Старый 14.12.2011, 04:27   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
sumitsaxfactor: Find Active Dimensions for a Legal Entity [Ax2012]
Источник: http://sumitsaxfactor.wordpress.com/...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;

staticvoid 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

    selectcount(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

    whileselect * from dimAttr

        orderby Name

            where dimAttr.Type != DimensionAttributeType::MainAccount

        join RecId from dimAttrSetItem

            where dimAttrSetItem.DimensionAttribute == dimAttr.RecId &&

                dimAttrSetItem.DimensionAttributeSet == dimensionSetId

    {

        info(dimAttr.Name);

    }

}








Источник: http://sumitsaxfactor.wordpress.com/...entity-ax2012/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.