container column contents

Hello,

One of my Ax tables has a column of the data type container. The column name is xyzQuery. The content of this column is used to instantiate a runQuery as in the statement:

queryRun = new QueryRun(myTable.xyzQuery);

The statement executes without any problem. So, I’m guessing the content of this column is a query object. I can assign this column to a container like so:

container con;

con = myTable.xyzQuery;

In the debugger, I see that the container size is 1 and the datatype of the first element is blob.

I get a run time error (Wrong argument type) when I execute the statement:

info(strFmt(conPeek(con, 1)));

When I view the table in AX-AOT, the column is blank. If i View the table in SSMS, it is an unintelligible stream of bytes. So, how can I view the contents of this column?

Thanks.

Use this,
info(strFmt(’%1’, conPeek(con, 1)));

The content isn’t a query object, is QueryRun object’s state serialized to binary data. The bits won’t make much sense unless you deserialize the object as above.

The debugger stops at the line

info(strFmt(’%1’, conPeek(con, 1)));

and throws an error: Wrong argument type for function.

The typeof(conPeek(con, 1)) returns a value of 13 (blob). The question is how do I serialize the blob?

Thanks.

You already have it above: QueryRun qr = new QueryRun(myTable.xyzQuery).

Thanks Martin. Yes, I already have it. I later used qr.query().datasource(1).toString(); to get the x++ query.

Thanks Martin. Yes, I already have it. I later used qr.query().datasource(1).toString(); to get the x++ query.