SysQueryForm add field in lookup

I would like to add the field_id in the range lookup to see the true database fieldName but I`m not able to display any row in lookup.

Is it possible to modify sysqueryform lookup?

public void lookup() // this is what i have tried


SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(TmpSysQuery),this);

Query query = new Query();

QueryBuildDataSource queryBuildDataSource;


queryBuildDataSource = query.addDataSource(tablenum(TmpSysQuery));






Field_Id has the Visible property set to No. Isn’t that the problem?

Actualy I want fieldName and not field_id sorry.

In the form sysQueryForm, the datasource → Range → fields ->FieldLabel have the method lookup.

I think this is where I should add my field FIELDNAME

I saw something lookups on SysQueryForm

using the public void lookup(FormControl _formControl, str _filterStr) method for customisation

But in my case i just want to add field name beside field label in the lookup feilds… should`nt be hard… but hard for me :stuck_out_tongue:

I maid a temporary solution that display the fieldName in a textbox by modifing the method Range.FieldLabel: modified

public void modified()



range.LookupButton = sysLookup::lookupValidate(range.RangeStatus, range.Table_Id, range.Field_Id);


fieldNameResult.text( dbutil::FieldName( tableId2Name(Range.Table_Id), Range.Field_Id));


This is what Im trying to get on the query form.

A new column fieldName

I think you already reply to a similar request back in 2011

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.

Thanks Martin

simple code

at classDeclaration
SysTableFieldLookup tableFieldLookup; // function for lookup field
TmpSysTableField tmpSysTableField; // to catch selected lookup value

at lookup method:
Query query = new Query();
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

Hi Dominic,

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.