Problem with save/restore query in a container type table field

Hi All,

I’m trying to save/restore query in a container type table field (I learned this way from Mirko Bonello’s blog). I just want to show select button at my form’s grid, select ranges for every record of table. But it shows same ranges at all of the table. This’s my table method code, I call it from my form:

void createAndSaveQueryInTable()
QueryRun qRun;
Query q;
QueryBuildDataSource qbds;
QueryBuildRange qRange;

if (this.InventTableQuery)
qRun = new QueryRun(this.InventTableQuery);
q = new query();
qbds = q.addDataSource(tablenum(InventTable));
qbds = qbds.addDataSource(tablenum(RBOInventTable));
qbds = qbds.addDataSource(tablenum(PriceDiscTable));
qRange = qbds.addRange(fieldNum(PriceDiscTable,ItemCode));
qRun = new QueryRun(q);
if (qRun.prompt())
this.InventTableQuery = qRun.pack();

I found the reason:

When query dialog shown, Select query combobox selected as default “query used before”. How can I prevent this? I have to show “used query” (Dialogs would be different in english, because I translated from turkish AX).

I found the second answer too:

use sysqueryrun instead of queryrun



thank you all,