Hi,
I have created an AX job to test an AX query. The query I'm trying to test is AxdPurchaseRequisition. Actually, I have disabled a number of datasources in the query. I only keep 3 data sources enabled.
- VendPurchOrderJour
- PurchTableAllVersions
- PurchLineAllVersions

For these datasources the FetchMode propery is set to "1:n", the JoinMode property is set to "OuterJoin".
The job code looks like this
Query q = new Query(queryStr(AxdPurchaseRequisition));
QueryRun qr;
Common vpoj;
Common ptav;
Common plav;
QueryBuildDataSource qbds_vpoj;
QueryBuildRange qbr_vpoj_purchid;
qbds_vpoj = q.dataSourceName("VendPurchOrderJour");
qbr_vpoj_purchid = qbds_vpoj.addRange(fieldNum(VendPurchOrderJour, PurchId));
qbr_vpoj_purchid.value(queryValue("2100002142"));
qr = new QueryRun(q);
while (qr.next())
{
vpoj = qr.get(tableName2Id("VENDPURCHORDERJOUR"));
ptav = qr.get(tableName2Id("PURCHTABLEALLVERSIONS"));
plav = qr.get(tableName2Id("PURCHLINEALLVERSIONS"));
info(strFmt("vpoj recid = %1 > ptav recid = %2 > plav recid = %3", vpoj.RecId, ptav.RecId, plav.RecId));
}
When I run this code, an exception immediately occurs when following line of code is executed.
while (qr.next())
Cannot select a record in Purchase order confirmations (VendPurchOrderJour).
InMemory temporary tables must be the outer tables when they are joined to a TempDB table or permanent table.
I am not aware of any InMemory temporary table in this query.
What could be the problem here?
Thanks,
Frederiek