Ranges

Hi.

public void init()
{
QueryBuildDatasource PurchLineDS, PurchTableDS;

super();

PurchLineDS = PurchLine_ds.query().dataSourceNo(1);

zakres1 = PurchLineDS.addRange(fieldnum(PurchLine, ItemId));

PurchTableDS = PurchTable_ds.query().dataSourceTable(tablenum(PurchTable));
zakres = PurchTableDS.addRange(fieldnum(PurchTable, PurchId));

}

public void executeQuery()
{

;

super();

zakres1.value(queryValue(inventTable.ItemId));

info(purchTable.PurchId);

}

I have 3 grids: InventTable, Purchtable, PurchLine. I mark in InventTable record and I have the PurchLineDS query build.

And I want to Have field PurchId joined with field PurchId from PurchTableDS.Do You have any ideas how to do it??

How are the data sources (InventTableDs and PurchTableDs) linked? I would set PurchTableDs is set as the child data source of InventTableDs and LinkType is Delayed. If there is a relation between these tables, it should work without any code at all.

There are no relation between those tables. So i must get together Inventtable PurchLine and PurchTable, because there is a relation InventTable.ItemId==PurchLineItemId and PurchLine.PurchId == Purchtable.PurchId. I don know how to connect them

You haven’t answered my question, therefore I can’t be more specific than this:

Try follwing code . i hope that it’ll resolve your issue .

public void executeQuery()

{

QueryBuildDatasource QBDSInventtable,QBDSPurchLine,QBDSPurchTable;

;

QBDSInventtable =q.addDataSource(tablenum(InventTable));

QBDSPurchLine = QBDSInventtable.addDataSource(tablenum(PurchLine));

QBDSPurchLine.relations(false);

QBDSPurchLine.addLink(fieldnum(InventTable,ItemId),fieldnum(PurchLine,ItemId));

QBDSPurchLine.joinMode(joinmode::ExistsJoin);

QBDSPurchTable = QBDSPurchLine.addDataSource(tablenum(PurchTable));

QBDSPurchTable.addLink(fieldnum(PurchTable,PurchId),fieldnum(PurchLine,PurchId));

QBDSPurchLine.addRange(fieldnum(InventTable,ItemId)).value(queryvalue(InventTable.ItemId));

super();

}

Don’t forget to verfied Solution