Hi,
void lookupJobId(FormControl control)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup;
;
//Create an instance of SysTableLookup with the form control passed in
sysTableLookup = SysTableLookup::newParameters(tablenum(InventTable), this);
//Add the fields to be shown in the lookup form
sysTableLookup.addLookupfield(fieldnum(InventTable, ItemId), true);
sysTableLookup.addLookupMethod(tablemethodstr(InventTable, ItemName), false);
//create the query datasource
queryBuildDataSource = query.addDataSource(tablenum(InventTable));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(InventTable ,ABCValue));
queryBuildRange.value(enum2str(ABC::A)); //Example of Enum value
//add the query to the lookup form
sysTableLookup.parmQuery(query);
// Perform lookup
sysTableLookup.performFormLookup();
}
/***************************************************************/
If the filter with reference to the enum field already existing in form then.
void lookupJobId(FormControl control)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup;
;
//Create an instance of SysTableLookup with the form control passed in
sysTableLookup = SysTableLookup::newParameters(tablenum(InventTable), this);
//Add the fields to be shown in the lookup form
sysTableLookup.addLookupfield(fieldnum(InventTable, ItemId), true);
sysTableLookup.addLookupMethod(tablemethodstr(InventTable, ItemName), false);
//create the query datasource
queryBuildDataSource = query.addDataSource(tablenum(InventTable));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(InventTable ,ABCValue));
//Direct filter for enum ABC::A
queryBuildRange.value(enum2str(ABC::A)); //Example of Enum value
//else
//consider the enum fields is stored in header table as HeaderTableName.EnumField
//Make sure that EnumField should be ABC enum
queryBuildRange.value(enum2str(str2enum(ABC,HeaderTableName.EnumField)));
//add the query to the lookup form
sysTableLookup.parmQuery(query);
// Perform lookup
sysTableLookup.performFormLookup();
}
Regards,