Change Query

Hi I want to change a Query Range. How can I do it??

public void executeQuery()

Query purchLineQuery, purchTableQuery;

QueryRun purchLineQR;


purchLineQuery = PurchLine_ds.query();
purchLineQuery.dataSourceNo(1).addRange(fieldnum(purchLine, ItemId)).value(“00024”);

purchTableQuery = PurchTable_ds.query();

purchLineQR = new QueryRun(purchLineQuery);


purchLine = purchLineQR.get(tableNum(PurchLine));

purchTableQuery.dataSourceNo(1).addRange(fieldnum(purchTable, PurchId)).value(PurchLine.PurchId);


purchLineQuery.dataSourceNo(1).addRange(fieldnum(purchLine, PurchId)).value(“PO-013330”); // <------ ##LOOK HERE

PurchTableQR = new QueryRun(purchLineQuery);


purchLine = purchTableQR.get(tablenum(PurchLine));




Why you are looping through the query multiple times by adding ranges. Add the ranges at once and then call the

Not sure about the requirement of your code, but while loop in executeQuery() method is not good.


because in the first grid where data source is PurchTable I want o have all records where ItemId in Purch Line is 00024.

and in the second grid where data source is PurchLine I want have all records where PurchId is “PO-013330”. all I want in one form write ic x++

the relation is PurchLine.PurchId == PurchTable.PurchId

You have two grids with two data sources, do they are linked. Do the purchLine grid shows the information based on the purchTable chosen.

My project is not good. thanks for help