Monday, 14 November 2016


How to add field lookup in your form.




Today i met i problem where i want to create a new line and select item from item field lookup .
But the problem is , client want he want to see item details which is filled in another form.

Example : one form RackInqueryForm , attach RackInqueryTable having these field

Now i want all the field in another form when i lookup by item id. in second form

Second form StockInOutForm .


Go to second form StockInOutForm -> datasource -> field itemid ->mathod -> overrides mathod.
Lookup mathod.

public void lookup(FormControl _formControl, str _filterStr)
{

   sysTableLookup  sysTableLookup = sysTableLookup::newParameters(tablenum(RackInqueryTable), _formControl);

   Query query;
   querybuildDatasource querybuildDatasource;
   ;

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, itemid),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, itemname),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, Rack),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, Shelf),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, Onhandrack),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, RamainRackQty),true);

query  =new query();
queryBuildDataSource = query.addDataSource(tablenum(RackInqueryTable));

   // Add sorting index to query

   sysTableLookup.parmQuery(query);

   sysTableLookup.performFormLookup();




  // super(_formControl, _filterStr); // if this line is in not comment then it will lookup dual , //first your query and second default query
}





Thanks 

Akshay




No comments:

Post a Comment