How to get the two different table lookup fields in form control.

Hi all,

I need to lookup on different table fields. how to do this please give me any suggestions ax 2012 R3.

i am using the below code. but it's getting error.

Error: Failed to execute query because no root data source on the form matches the root datasource on the query.

public void lookup()
{
SysTableLookup sysTableLookup;
Query query;
QueryBuildDataSource qbds;
QueryBuildDataSource qbds1;
QueryBuildRange qbr;

query = new Query();
qbds = query.addDataSource(tableNum(HcmJob));
qbds1 = qbds.addDataSource(tableNum(HcmJobDetail));
qbds1.relations(true);

qbds1.fields().dynamic(NoYes::Yes);
qbds1.addLink( fieldNum(HcmJobDetail, job), fieldNum(HcmJob, RecId));
qbds1.joinMode(JoinMode::InnerJoin);

sysTableLookup = SysTableLookup::newParameters(tableNum(HcmJob), this);
sysTableLookup = SysTableLookup::newParameters(tableNum(HcmJobDetail), this);
sysTableLookup.addLookupfield(fieldnum(HcmJob,JobId));
sysTableLookup.addLookupfield(fieldnum(HcmJobDetail,Description));

sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}

Related
Recommended