how to create lookup in AX 2012 control with fields from more than one datasource

public void lookup()

{

query = new Query();

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

qbds = query.addDataSource(tablenum(smmBusRelTable));

// qbds.addDataSource(tableNum(DirPartyTable));

//qbds.relations(true);

sysTableLookup.parmQuery(query);

sysTableLookup.addLookupField(fieldNum(smmBusRelTable, Busrelaccount));

//sysTableLookup.addLookupfield(fieldNum(DirPartyTable, Name));

sysTableLookup.performFormLookup();

}

Hi,

This is the sample job for creating query with multiple datasource.Based on this logic you create your query and pass it to sysTableLookup.parmQuery(query);

static void Job2(Args _args)
{
Query qry = new Query();
QueryBuildDataSource qbd;

qbd = qry.addDataSource(tableNum(VendTable));
qbd = SysQuery::findOrCreateDataSource(qry, tableNum(VendTrans), tableNum(VendTable));
qbd.relations(true); // if table relation is available
qbd.addLink(fieldNum(VendTable,AccountNum),fieldNum(VendTable,AccountNum)); // if table relation is not available
}