public void lookup()
{
SysTableLookup sysTableLookup;
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange qbr;
CustomerPreferenceTable custPrefTable;
;
select count(ItemId) from custPrefTable where custPrefTable.AccountNum==SalesLine.CustAccount;
if(str2int(custPrefTable.ItemId)>0)
{
//Box::info("Called1");
sysTableLookup = SysTableLookup::newParameters(tablenum(CustomerPreferenceTable), this);
queryBuildDataSource = query.addDataSource(tablenum(CustomerPreferenceTable));
qbr=queryBuildDataSource.addRange(fieldNum(CustomerPreferenceTable,AccountNum));
qbr.value(SalesLine.CustAccount);//filters the query based on the selected customer account Number from CustomerPreferenceTable
super();
sysTableLookup.addLookupfield(fieldnum(CustomerPreferenceTable, ItemId));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
else
{
sysTableLookup = SysTableLookup::newParameters(tablenum(InventTable), this);
// Box::info("Called1");
// qbr=queryBuildDataSource.addRange(fieldNum(InventTable,ItemId));
//qbr.value(SalesLine.CustAccount);//filters the query based on the selected customer account Number from CustomerPreferenceTable
queryBuildDataSource = query.addDataSource(tablenum(InventTable));
super();
sysTableLookup.addLookupfield(fieldnum(InventTable, ItemId));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
}
No comments:
Post a Comment