Monday, December 10, 2018

To fetch Department Dimension using X++

public void lookup()
{
    Query                   query  = new Query();
    QueryBuildDataSource    qbds;
    SysTableLookup          sysTableLookup;
    sysTableLookup = sysTableLookup::newParameters(tableNum(OMOperatingUnit),this);
    sysTableLookup.addLookupfield(fieldNum(OMOperatingUnit,OMOperatingUnitNumber));
    sysTableLookup.addLookupfield(fieldNum(OMOperatingUnit,Name));
    sysTableLookup.addLookupfield(fieldNum(OMOperatingUnit,OMOperatingUnitType));
    sysTableLookup.addSelectionField(fieldNum(OMOperatingUnit,Name));
    qbds = query.addDataSource(tableNum(OMOperatingUnit));
    qbds.addSortField(fieldNum(OMOperatingUnit,OMOperatingUnitNumber));
    qbds.addRange(fieldNum(OMOperatingUnit,OMOperatingUnitType)).value(enum2str(OMOperatingUnitType::OMDepartment));
    sysTableLookup.parmQuery(query);
    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;     /// ...