Create lookup method in dialog

Creates the lookup( ) and filter the records based on the different inputs from different tables …

Ex : Selecting the RegionCode in the dialog (input field) should filter the records in BranchNames (another input field in the same dialog) and show the BranchNames corresponding to the RegionCode… so here filter can be done based on the RegionCode…

  • MainTable - SefTable - Contains some fields including BranchName, BranchCode, RegionCode
  • RegionTable Contains the fields RegionCode, RegionName
  • BranchTable Contains the fields BranchName, BranchCode, RegionCode

public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup;

;

sysTableLookup = SysTableLookup::newParameters(tablenum(tablename), this);
sysTableLookup.addLookupfield(fieldnum(tablename, BranchName));

sysTableLookup.addLookupfield(fieldnum(tablename, BranchCode));

sysTableLookup.addLookupfield(fieldnum(tablename, RegionCode));

qbds = query.addDataSource(tablenum(tablename));
QueryBuildRange = qbds.addRange(fieldnum(tablename,RegionCode));
QueryBuildRange.value(RegionCode.valueStr()); // Make the auto declaration yes for that control and do it.
if(sysTableLookup)
{
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}

}

Regards,

S.Kuppusamy

Look at this website.You can add different datasource and ranges.

http://axdeveloper.wordpress.com/2014/08/04/lesson60-lookup-5-sysmultitablelookup/#more-1741