Use SysTableFieldLookup class. Pass the form query to the constructor, save TableId to TmpSysTableField table (DictTableId field) and pass it to performLookupField().
I`m trying to follow you instruction here but my level of expertise is not enough to follow your instructions…
Could you elablorate a bit more or in the best world … a small .xpo that represent these changes.
at classDeclaration
SysTableFieldLookup tableFieldLookup; // function for lookup field
TmpSysTableField tmpSysTableField; // to catch selected lookup value
at lookup method:
Query query = new Query();
;
query.addDataSource(tableNum(SalesLine));
tableFieldLookup = new SysTableFieldLookup(query);
tmpSysTableField.DictTableId = tableNum(SalesLine);
tableFieldLookup.performLookupField(this, tmpSysTableField); // lookup display label description
at modified method after super
FieldId fieldIdNum;
fieldIdNum = tableFieldLookup.parmSelectedRecord().FieldId; // get the field id
What you should do is create a display method on TmpSysQuery like so
display FieldName FieldName()
{
return fieldId2name(this.Table_Id,this.Field_Id);
}
then add the display method to the grid on the form SysQueryFieldLookup. make sure the datasource “Allfields” is set as the datasource of the display method control which you added.
I think that is about it. The lookup should now have the field label as well as the fieldname. You should be able to take it from here.