Monday, May 21, 2018

How to write a generate method to map the default dimension

[DMFTargetTransformationAttribute(true),DMFTargetTransformationDescAttribute("@DMF1365"),
DMFTargetTransformationSequenceAttribute(24)
,DMFTargetTransFieldListAttribute([fieldStr(DMFLedgerJournalEntity,CICDepartments),fieldStr(DMFLedgerJournalEntity,CICProfitCenter),fieldStr

(DMFLedgerJournalEntity,CICDivisions)])
]
public container CICgenerateDimension(boolean _stagingToTarget = true)
{
    container                       res,varContainer;
    Counter                         varCounter=0;
    RecId                           retValueOfDefDimension;


    if (_stagingToTarget)
    {
        varContainer = [0];

        //assigning one dimension
        if(entity.CICDepartments)
        {
            varContainer += ['Department',entity.CICDepartments];
            varCounter++;//increase on ssignmnet of each dimension
        }

        //assigning 2nd dimension
        if(entity.CICProfitCenter)
        {
            varContainer += ['ProfitCenter',entity.CICProfitCenter];
            varCounter++;//increase on assignmnet of each dimension
        }

        if(entity.CICDivisions)
        {
           //assigning 3rd dimension
            varContainer += ['Divisions',entity.CICDivisions];
            varCounter++;//increase on assignmnet of each dimension
        }
        //so on.. you can pass any number of dimensions

        //prepare container
        varContainer = conPoke(varContainer,1,varCounter);

        //pass continer and get back value generated
        retValueOfDefDimension = AxdDimensionUtil::getDimensionAttributeValueSetId(varContainer);

        //Return the default dimension
        if(retValueOfDefDimension)
            res=[retValueOfDefDimension];         

    }
    return res;
}


-----------------------------------------------------------------------------------------------------------------
//assign the return value to the target table field in getReturnFields method


        case methodStr(DMFLedgerBalanceEntityClass, CICgenerateDimension) :
        con += [fieldstrToTargetXML(fieldStr(LedgerJournalTrans, DefaultDimension))];
        break;

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// ...