Wednesday, August 8, 2007

how to make look up

The super() call in Lookup checks whether the control is bound to a field, or to an Extended Data Type and calls either




which are both member functions (methods) on the Formcontrolname class (FormStringControl, FormRealControl, FormIntControl, FormDateControl or FormTimeControl).

You can override the super() call, and call one or the other method yourself, and give the necessary parameters.

One possibility is to call performDBLookup with only FieldId, in which case you can perform a lookup on another field within the same data source.

void Lookup()


FormStringControl FEL;

FEL =;

//12 is the Id for the field to be shown on the Country control



Both methods may also be called with an alternative Company to achieve a lookup in another data file. Default company is the one that the current data source belongs to.

Sample Code

public void lookup()
Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;

// Create an instance of SysTableLookup where 'this' the current Form control.

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(LedgerJournalName), this);


// The field to be shown in the lookup form.

sysTableLookup.addLookupField(fieldNum(LedgerJournalName, JournalName));

// Limit and arrange data selection.

queryBuildDataSource = query.addDataSource(tableNum(LedgerJournalName));

queryBuildRange = queryBuildDataSource.addRange(fieldNum(LedgerJournalName, JournalName));


// Perform lookup



No comments: