Reviewing some code I've come across I noticed a strange behavior: working with the same table, in two different modes yielded two different results. The task requested was to translate a while select statement into an insert_recordset operation.
All seemed very easy to accomplish, until several minutes later the results appeared to be different if you ran the code one way compared to the other: different meaning the number of rows retrieved was different. After some investigation, I recall that somebody mentioned to me the exact same thing earlier on. That was: the table I was selecting from was a ValidTimeState table.
So, the issue is simple: the where clauses that are being applied automatically by the AX kernel on a select statement or an AOT query, are not being applied to recordset operations.
In the end, what this means is that you have to add them manually. Basically it will be
insert_recordset tableTmp(column)
select column from validTimeTable
where validTimeTable.ValidFrom < systemDateGet() &&
validTimeTable.ValidTo > systemDateGet()
No comments:
Post a Comment