Monday 10 April 2017

Selecting Multiple literals of Lookup using SysLookupMultiSelectCtrl

//Declare SysLookupMultiSelectCtrl  class in form classdeclaration

public class FormRun extends ObjectRun
{
    SysLookupMultiSelectCtrl    msCtrl;
   
}

//write the following code in Form Init method to  assign Query

public void init()
{

    Query                query = new Query();

    QueryBuildDataSource qbds;

    super();

 //the query must contain only those fields that should be visible on the lookup

    qbds = query.addDataSource(tableNum(Purchline));

    qbds.fields().dynamic(NoYes::Yes);

    qbds.fields().addField(fieldNum(Purchline,ItemId));

  //assigning control and query to the class

    msCtrl = SysLookupMultiSelectCtrl::constructWithQuery(element, PurchLine_ItemId, query);

}

No comments:

Post a Comment