Thursday, September 05, 2013

Lookup dimension attributes used in a company.

This job look up the financial dimension attributes which are being used in the current company/entity. I used it while writing certain import customization. You might find other use of it.
  
static void Job_GetDefaultDimensions(Args _args)
{
    DimensionEnumeration            dimEnum;
    DimensionAttributeSetItem       dimAttrSetItem;
    DimensionAttribute              dimAttr;
    
    container   cDimAttr, cDimAttrName;

    // Get the financial dimensions
    dimEnum = DimensionCache::getDimensionAttributeSetForLedger();

    while select * from dimAttr
        order by dimAttr.Name asc
        join dimAttrSetItem
        where dimAttrSetItem.DimensionAttribute == dimAttr.RecId
            && dimAttrSetItem.DimensionAttributeSet == dimEnum
            && dimAttr.Name != "MainAccount"
    {
        cDimAttr = conIns(cDimAttr, conLen(cDimAttr)+1, dimAttr.recId);
        cDimAttrName = conIns(cDimAttrName, conLen(cDimAttrName)+1, dimAttr.Name);
    }
}              
This posting is provided "AS IS" with no warranties, and confers no rights.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete