As you probably have noticed - the blocked checkbox is repeated 3 times for each item - 1 for each module type (Invent, Purch, Sales)
Here is an example of a simple lookup that includes filtering on non-blocked items - but what you have to do is pass on the module it is used it.
client static void lookupItemId(FormStringControl _fc, ModuleInventPurchSales _module)
{
sysTableLookup sysTableLookup;
Query query;
QueryBuildDataSource queryBuildDataSource;
QueryBuildDataSource queryBuildDataSourceModule;
QueryBuildRange queryBuildRange;
QueryBuildRange qbrBlocked;
;
`
//this will disable the filtering on input - you can comment it out
_fc.text("");
sysTableLookup = sysTableLookup::newParameters(tableNum(InventTable), _fc);
sysTableLookup.addLookupfield(fieldNum(InventTable, itemId));
sysTableLookup.addLookupfield(fieldNum(InventTable, itemName));
query = new Query();
queryBuildDataSource = query.addDataSource(tableNum(InventTable));
//this sorts the inventory based on the name of items - mostly what users ask to do all the time
//can comment it out too
queryBuildDataSource.addSortField(fieldNum(InventTable, ItemName));
queryBuildDataSourceModule = queryBuildDataSource.addDataSource(tableNum(InventTableModule));
queryBuildDataSourceModule.addLink(fieldNum(InventTable, ItemId), fieldNum(InventTableModule, ItemId));
queryBuildDataSourceModule.addRange(fieldNum(InventTableModule, ModuleType)).value(queryValue(_module));
queryBuildDataSourceModule.addRange(fieldNum(InventTableModule, Blocked)).value(queryValue(NoYes::No));
//this will show you the formed query
// info(queryBuildDataSource.toString());
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
I guess after reading this code you won’t have any problem modifying the form InventItemIdLookupSimple
`
The InventTable form has to be modified similarily, (the datasources are already there), as faonly you will have to add a checkbox or something on the form and then check it's value on execute query and modify the range of blocked field