Reputation: 1369
Has anyone ever created a dynamic dialog formstringcontrol with a lookup that contains two columns? Something like VALUE - DETAILS where Value is returned to the field upon selection.
For me, this generally works, except the second (details) column always comes back as Unretrieved.
Query query = new Query();
QueryBuildDataSource datasource;
QueryFilter qFilter;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(MyTable), _control);
sysTableLookup.addLookupField(fieldNum(MyTable, Field1));
sysTableLookup.addLookupField(fieldNum(MyTable, Field2));
datasource = query.addDataSource(tableNum(MyTable));
datasource.addGroupByField(fieldNum(MyTable, Field1));
datasource.addOrderByField(fieldNum(MyTable, Field1));
qFilter = query.addQueryFilter(datasource,'Field3');
qFilter.value('FilterValue');
}
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
Upvotes: 0
Views: 354
Reputation: 1369
This ended up being very simple.
The second field was not included in the group by values, but was a string, and thus could not be aggregated. Therefore it was unretrieved.
In this case, I was just able to remove the Group By attribute, but I suspect grouping by both would have fixed it as well.
Upvotes: 2