I have developed a NAV batch which updates some data in a table based on some calculations.
I ran the batch last time and I found out some updates were not done at all in the table and when I re-run it did updated.
I am now confused why it happend. I did not make any changes as the code looks fine to me , I just re-run it.
This routine updates thousands of entries but 2nd time it got it lucky not sure why not 1st time it did not work.
Any suggestions?
United Kingdom
0
Comments
Which tables did you update (std/custom)? Was your first run simultaneous with some users' posting transactions? How much time passed between 1st and 2nd run?
The table is customized ledger entries.
The problem is basically the loop at one piece of code wasn't working. The loop had 20 records to loop but it was doing just one time. the I removed SETCURRENTKEY code before filtration and it worked fine.
Why is that I don't remember I faced this issue before.
So my code was
record.reset;
record.setcurrentkey(field1,field2,field3);
record.setrange(field1,value);
record.setrange(field2,value);
record.setrange(field3,value);
if record.find('-') then
repeat
//do something
record.modify
until record.next = 0;
end;
the I commented setcurrentkey part of code and worked fine.
Please help as I have lot of codes like that and I want to know what I am doing wrong here?
thanks
Thanks
Did you modify the value of Field1, 2 or 3 in your "do something" ?
Yes I was doing exactly that. Your code makes sense thanks.
What makes me worried though is - this is my 7th year as NAV Developer : :roll:
Does this happen to Experienced NAV developers, not knowing some basic things?
But even with my +/- 10 years of NAV coding experience, i have made the same mistake once or twice.....we are only human
But even with my +/- 10 years of NAV coding experience, i have made the same mistake once or twice.....we are only human [/quote]
Thanks . Yes we are humans