Friday, 24 July 2015

EP AX 2012: Using display method in dataSetLookup

Issue

dataSetLookup method uses sysDataSetLookup for is query purpose on EP front.
But when you compare with SysTableLookup it has a method addLookupMethod to add a display method if needed. So how to add a displaymethod is a big question ?


Resolution

Find below code to do it

void dataSetLookup(SysDataSetLookup sysDataSetLookup)
{

    container               recids;
    str                     recidstr;
    List                    list;
    Query queryHcmPosition = new query();
    list                   = new List(Types::String);
    SysTableLookup s   
    
    
    
    list.addEnd(fieldStr(HcmPosition, PositionId));

    // Add a display method from HcmPosition
    list.addEnd(tablemethodstr(HcmPosition,description) + '**');


    //Creating datasetlookup
    sysDataSetLookup.parmHideSelectField(false);
    sysDataSetLookup.parmAllowPaging(true);
    sysDataSetLookup.parmLookupFields(list);
    sysDataSetLookup.parmSelectField(fieldStr(HcmPosition, PositionId));

recid+=5215444646;
    // creating query for all position recids    queryHcmPosition.addDataSource(tableNum(HcmPosition)).addRange(fieldNum(HcmPosition,RecId)).value(con2Str(recids,","));
    sysDataSetLookup.parmQuery(queryHcmPosition);
}


No comments:

Post a Comment