Lookup 2 Tables using union

Dear Friends,

I hv some problems.

I am making a lookup method and i need to union two tables (VendTable and CustTable)

I am writting the code but didnt work, can u give me an idea what went wrong

public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbdsVend, qbdsCust;
QueryBuildLink qblink1;
SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(VendTable), this);

qbdsVend = query.addDataSource(tableNum(VendTable));
qbdsCust = qbdsVend.addDataSource(tableNum(CustTable));
qbdsCust.relations(false);
qbdsCust.joinMode(JoinMode::NoExistsJoin);

qblink1 = qbdsCust.addLink(FieldNum(VendTable,AccountNum),FieldNum(CustTable,AccountNum));

sysTableLookup.addLookupfield(fieldNum(VendTable,AccountNum));

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

Hi

public void lookup()

{

Query query = new Query();

QueryBuildDataSource qbdsVend, qbdsCust;

QueryBuildLink qblink1;

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

;

qbdsVend = query.addDataSource(tableNum(VendTable));

qbdsCust = qbdsVend.addDataSource(tableNum(CustTable));

qbdsCust.relations(false);

qbdsCust.joinMode(JoinMode::NoExistsJoin);

qblink1 = qbdsCust.addLink(FieldNum(VendTable,AccountNum),FieldNum(CustTable,AccountNum));

sysTableLookup.addLookupfield(fieldNum(VendTable,AccountNum));

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

super();

}

i mean that you missed super() … i hope that will work properly

Dont forget to Verfied solution if it is useful for u…

You talk about union and implement exists join instead. These are completely different things.

If you want a real union query, see an example here.