Getting Individual Dimension Combination Values–Using Views [AX 2012]

In my previous post, I had illustrated how we can get individual dimension combination values using DimensionStorage class. In this post, I will provide another job that utilizes a view to get individual values for a ledger dimension.
The view that has been used in DimensionAttributeLevelValueAllView. Here is the job
static void sgxIndividualDimensionValuesUsingView(Args _args)
    GeneralJournalAccountEntry          generalJournalAccountEntry; //Table that stores ledger transactions
    DimensionAttributeLevelValueAllView dimAttrView; //View that will display all values for ledger dimensions
    DimensionAttribute                  dimAttr; //Main dimension attribute table
    int i;
    setPrefix(‘Ledger dimension breakup’);
    while select generalJournalAccountEntry
        if (i > 100)
        setPrefix(int2str(i) + “. “ + DimensionAttributeValueCombination::find(generalJournalAccountEntry.LedgerDimension).DisplayValue);
        while select DisplayValue from dimAttrView   
            where dimAttrView.ValueCombinationRecId == generalJournalAccountEntry.LedgerDimension
            join BackingEntityType from dimAttr
                where dimAttr.RecId == dimAttrView.DimensionAttribute
            switch (dimAttr.BackingEntityType)
                case tableNum(DimAttributeMainAccount):
                    info(strFmt(“Main Account: %1″, dimAttrView.DisplayValue));
                case tableNum(DimAttributeOMBusinessUnit):
                    info(strFmt(“Business Unit: %1″, dimAttrView.DisplayValue));

                case tableNum(DimAttributeCustTable):
                    info(strFmt(“Customer: %1″, dimAttrView.DisplayValue));

                case tableNum(DimAttributeOMDepartment):
                    info(strFmt(“Department: %1″, dimAttrView.DisplayValue));

                case tableNum(DimAttributeHcmWorker):
                    info(strFmt(“Worker: %1″, dimAttrView.DisplayValue));

Here is the output.
Posted by  on June 15, 2012 in AX 2012

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.