Find Active Dimensions for a Legal Entity in Ax2012
Hi,
Please use the below code to find the active dimension by legal entity. it will be useful when we do data upload.
Please use the below code to find the active dimension by legal entity. it will be useful when we do data upload.
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);
}
}
Thanks,
Vijaykarthik
Comments
Post a Comment