Save and load a Query from table

Hello together,

I would like save a query into a table. I have found the following link which exactly this case.

http://dynamicsax-dev.blogspot.com/2008/10/displaying-and-saving-query.html

I have tried it but I get the following error message while compiling:

The field must be a data element that allows assignment.

The code which I use is the follows:

void clicked()
{
Query q = new Query();
QueryBuildDataSource qbds, qbdsSalesLine;
QueryBuildRange queryBuildRange ;
SalesTable salesTable;
QueryRun queryRun;

;
element.lock();
//queryRunTemplate = locWmsShipmentTemplate.queryRun();
//info(strfmt("%1", element.args().record()));

if(!element.args().record())
{
//throw error("@SYS31996");
}
salesTable = element.args().record();
qbds = q.addDataSource(tablenum(SalesTable));
queryBuildRange = qbds.addRange(fieldNum(SalesTable, SalesId));
queryBuildRange.value(salesTable.SalesId);
qbdsSalesLine = qbds.addDataSource(tablenum(SalesLine));
qbdsSalesLine.relations(true);

queryRun = new QueryRun(q);
info(q.xml());

if (! queryRun.prompt())
{
info(‘return’);
return;
}
My_Sales_Settings::find(salesTable.SalesId).QueryX = queryRun.pack();
element.unLock();
super();
}

QueryX is a container field of the Table.

Do anyone now what is wrong?

Best regards

cakbulut