Hi All,
The following is the code for lookup method at control level in form.
The following is the code for lookup method at control level in form.
public void lookup()
{
{
//add Query, QueryBuildDataSource, and QueryBuildRange objects. The following code example adds the classes you use to construct the query for the lookup form.
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
//Create an instance of SysTableLookup class. The following code example creates a lookup form for customers. Notice how this in the example represents the current form control.
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);
sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
sysTableLookup.addLookupField(fieldNum(CustTable, CustGroup));
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
sysTableLookup.addLookupField(fieldNum(CustTable, CustGroup));
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
//Use a query to retrieve data for the lookup form. The following code example uses a range limit so that the lookup form lists customers who have the customer group of 40.
queryBuildRange = queryBuildDataSource.addRange(fieldNum(CustTable, CustGroup));
queryBuildRange.value(’40’);
sysTableLookup.parmQuery(query);
queryBuildRange.value(’40’);
sysTableLookup.parmQuery(query);
//Use the performFormLookup method to open the lookup form.
sysTableLookup.performFormLookup();
//When you override the lookup method, comment out the call to super. If you do not comment out the call to super, the standard lookup form might appear.
//super();
}
Right-click the form and then click Save. To see the lookup form, right-click the form and then click Open. Find the StringEdit control and then click the arrow to open the lookup form.
Thanks & Happy DaXing……..:)
No comments:
Post a Comment