Tuesday, May 21, 2019

Query to get the Lookup on Financial dimension using X++

    Query                   query = new Query();
    QueryBuildDataSource    qbds,qbds1;
    SysTableLookup          sysTableLookup;
    #define.DimensionName("ProfitCenter")
    DimensionAttribute      dimAttr;

    sysTableLookup  = sysTableLookup::newParameters(tableNum(DimensionFinancialTag), _formStringControl);
    dimAttr         = DimensionAttribute::findByName("Profitcenter"); //Financial Dimension Name
    sysTableLookup.addLookupField(fieldnum(DimensionFinancialTag, Value));
    sysTableLookup.addLookupField(fieldnum(DimensionFinancialTag, Description));

    qbds = query.addDataSource(tableNum(DimensionFinancialTag));
    qbds1 = qbds.addDataSource(tableNum(DimensionAttributeDirCategory));
         qbds1.addLink(fieldNum(DimensionFinancialTag,FinancialTagCategory),fieldnum(DimensionAttributeDirCategory,RecId));
    qbds1.addRange(fieldNum(DimensionAttributeDirCategory, DimensionAttribute)).value(queryvalue(dimAttr.recid));

    sysTableLookup.parmQuery(query);
    sysTableLookup.parmUseLookupValue(false);
    sysTableLookup.performFormLookup();

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;     /// &l...