Thursday, February 28, 2019

How to select Financial Dimensions using the Default dimension value in X++?

dimStorage                  = DimensionAttributeValueSetStorage::find(custtrans.defaultdimension);

        for(i=1 ; i<= dimStorage.elements() ; i++)
        {
            if(DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name == #Product)
            {
                ProductUnit = dimStorage.getDisplayValueByIndex(i);

                select Value,Description from dimensionFinancialTag where dimensionFinancialTag.Value == ProductUnit;
                Product = dimensionFinancialTag.Description;
            }
            if(DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name == #ProfitCenter)
            {
                ProfitcenterUnit = dimStorage.getDisplayValueByIndex(i);

                select Value,Description from dimensionFinancialTag where dimensionFinancialTag.Value == ProfitcenterUnit;
                branchname = dimensionFinancialTag.Description;
            }
        }

How to select MainAccount using LedgerDimension in X++

With the help of getMainAccountFromLedgerDimension Method in DimensionAttributeValueCombination Table we can fetch the main account.


DimensionAttributeValueCombination::getMainAccountFromLedgerDimension(generalJournalAccountEntry.LedgerDimension);

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

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