I’m trying to make a lookup that contains fields from 3 different tables.
I created a temp table( InMemory type), put it as a datasource to my form.
Here is a code for lookup that i put in form datasource level code.
public void lookup(FormControl _formControl, str _filterStr)
{
TempTable tmp;
switch (HeaderTable.ProductTypes)
{
case ProductTypes::Product:
tmp.clear();
tmp.initValue();
tmp.ChangingField = "SearchName";
tmp.insert();
tmp.clear();
tmp.initValue();
tmp.ChangingField = "RetailColorGroupId";
tmp.insert();
tmp.clear();
tmp.initValue();
tmp.ChangingField = "RetailSizeGroupId";
tmp.insert();
tmp.clear();
tmp.initValue();
tmp.ChangingField = "RetailStyleGroupId";
tmp.insert();
break;
case ProductTypes::Variant:
tmp.clear();
tmp.initValue();
tmp.ChangingField = "SearchName";
tmp.insert();
tmp.clear();
tmp.initValue();
tmp.ChangingField = "RetailTotalWeight";
tmp.insert();
break;
}
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(TempTable), _formControl);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
queryBuildDataSource = query.addDataSource(tablenum(TempTable));
sysTableLookup.addLookupfield(fieldnum(TempTable, ChangingField), true);
sysTableLookup.parmQuery(query);
sysTableLookup.parmTmpBuffer(tmp);
sysTableLookup.performFormLookup();
}
The lookup doesn’t work.
Is there anything else that is needed to be done?