Buat lookup query yang menggunakan 2 tabel, dalam hal ini table CustVendtExternalItem digunakan sebagai filter.
public void lookup()
{
//super();
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(InventTable), this);
Query query = new Query();
QueryBuildDataSource qbds;
AccountNum vendorx;
;
qbds = query.addDataSource(tablenum(InventTable));
//CustVendExternalItem;
// DIP_ItemVendor
//
qbds = qbds.addDataSource(tablenum(CustVendExternalItem));
qbds.addLink(fieldnum(CustVendExternalItem,ItemId),fieldnum(InventTable,ItemId));
qbds.joinMode(JoinMode::ExistsJoin);
qbds.relations(true);
vendorx = PurchTable.OrderAccount;
qbds.addRange(fieldNum(CustVendExternalItem,ModuleType)).value('Vendor');
qbds.addRange(fieldNum(CustVendExternalItem,CustVendRelation)).value(vendorx);
sysTableLookup.addLookupfield(fieldnum(InventTable, ItemId));
sysTableLookup.addLookupfield(fieldnum(InventTable, ItemName));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}