I am not clear on your description of the problem. Replicate it in cronus company, and send it to MS. I'm sure they will look at it. If they don't know about it, they won't fix it, given that it actually is a bug.
Ahmed Rashed Amini
Independent Consultant/Developer
And - "just shooting into the dark":
If due to a NEXT statement records are "skipped", this usually means that you have changed the value of a field which is used in the current sorting (SETCURRENTKEY) ... you should check this ...
Hmmm, I'm still wondering what you mean by "SQL Optimizer".
If you experience a difference with recordsets & sortings between native and SQL you have to be aware, that there is a difference in sorting CODE fields:
While in "native" CODE values are sorted in a numeric way 1,2,3,4,5,6,7,8,9,10,etc. in SQL Server this is alphabetic: 1,10,11,12,13,14,15,2,20,etc.
My guess is, that when you start your "ItemLedgerEntry2" loop you do a SETCURRENTKEY on a CODE-type field which is changed within the loop ... this could cause the trouble you experience ...
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
And - "just shooting into the dark":
If due to a NEXT statement records are "skipped", this usually means that you have changed the value of a field which is used in the current sorting (SETCURRENTKEY) ... you should check this ...
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool
If you experience a difference with recordsets & sortings between native and SQL you have to be aware, that there is a difference in sorting CODE fields:
While in "native" CODE values are sorted in a numeric way 1,2,3,4,5,6,7,8,9,10,etc. in SQL Server this is alphabetic: 1,10,11,12,13,14,15,2,20,etc.
My guess is, that when you start your "ItemLedgerEntry2" loop you do a SETCURRENTKEY on a CODE-type field which is changed within the loop ... this could cause the trouble you experience ...
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool