Friday, April 25, 2014

Getting financial dimension values from DefaultDimension RecId

static void DEV_Dimension(Args _args)
{
     SalesTable salesTable;
     DimensionAttributeValueSetStorage dimStorage;
     Counter i;
     salesTable = salesTable::find("SO-101282");
     dimStorage = DimensionAttributeValueSetStorage::find(salesTable.DefaultDimension); //recid of 1101
     for (i=1 ; i<= dimStorage.elements() ; i++)
    {
         info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,
         dimStorage.getDisplayValueByIndex(i)));
     }
}

To get description of dimension value

public Description getDimensionAttributeDesc(DimensionDefault _defaultDimension)
{
    Description dimValue='';
    DEFAULTDIMENSIONVIEW dimensionView;
    DimensionAttribute dimensionAttribute;
   
    select firstOnly dimensionView
    where dimensionView.DefaultDimension == _defaultDimension            
    join dimensionAttribute
    where dimensionView.Name == dimensionAttribute.Name
    && dimensionView.Name == "GSECProject";
   
    dimvalue = DimensionFinancialTag::findByFinancialTagCategoryAndValue(dimensionAttribute.financialTagCategory(), dimensionView.DisplayValue).Description;
   
    return dimValue;
}

No comments:

Post a Comment