Step 1: Create a field with Name “ParentLevel” in VendTable string type. Create a form “VendGroupLookup” and drag- drop “VendTable” and “VendGroup” table in data source and in the VendTable data source set property “JoinSource - VendtGroup”. Create Designs like figure 1.
Figure 1: Create VendGroupLookup form.
Step2 – create a method on “VendTable”
public static void
lookupVendorGroup(FormControl _callingControl, VendGroupId _vendGroup)
{
Query query;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
SysTableLookup lookup;
;
query = new Query();
lookup =
SysTableLookup::newParameters(tablenum(VendTable),_callingControl);
qbds =
query.addDataSource(tablenum(VendTable));
lookup.addLookupField(fieldnum(VendTable, AccountNum),true);
lookup.addLookupField(fieldnum(VendTable, Name));
lookup.addLookupField(fieldnum(VendTable, VendGroup));
qbr =
qbds.addRange(fieldnum(VendTable, VendGroup));
qbr.value(queryvalue(_vendGroup));
lookup.parmQuery(query);
lookup.performFormLookup();
}
public void lookup(FormControl _formControl, str _filterStr)
{
;
VendTable::lookupVendorGroup(_formControl, VendGroup.VendGroup);
super(_formControl, _filterStr);
}
Figure 2: Result.
No comments:
Post a Comment