I have little bit problem with NAV ;-) I have very simple testing Code and I run it in Codeunit by Job Queue.
MyRec.Reset;
MyRec.SETRANGE( ... );
EventLogManagement.AddInfo('COUNT ' + FORMAT (OPImportHeader.COUNT));
IF OPImportHeader.FINDFIRST THEN
EventLogManagement.AddInfo('FIRST');
IF OPImportHeader.FINDLAS THEN
EventLogManagement.AddInfo('LAST');
IF OPImportHeader.FINDSET THEN
EventLogManagement.AddInfo('SET');
EventLogManagement.AddInfo is my function which write to special log.
And the problem is: I have these records in my log:
COUNT 23
LAST
but not FIRST, not SET. Next time there is COUNT 0, FIRST, LAST, SET. Any idea why?
If I run it from client it's always OK.
Version NAV 2017
Tomas Zadrapa
0
Answers
I'd be rather looking into EventLogManagement.AddInfo function. Comment your code like below and see what happens.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Sorry, there is everywhere MyRec .. I just rewrite the original code to basic code and this part I forget rewrite. So the code is:
MyRec.Reset;
MyRec.SETRANGE( ... );
EventLogManagement.AddInfo('COUNT ' + FORMAT (MyRec.COUNT));
IF OPImportHeader.FINDFIRST THEN
EventLogManagement.AddInfo('FIRST');
IF OPImportHeader.FINDLAS THEN
EventLogManagement.AddInfo('LAST');
IF OPImportHeader.FINDSET THEN
EventLogManagement.AddInfo('SET');
And if I comment the code, I have got right log records. So 4 records and COUNT 0, FIRST, LAST and SET.
To kriki
Yes I can use Message and after that read EventLog in system. And the result is exactly the same. Count and LAST works, First and SET not. Or better I have got random result :-(
Funny Code is this:
IF MyRecFINDFIRST then
MESSAGE ('1');
IF MyRecFINDFIRST then
MESSAGE ('2');
and I have only 2 in EventLog ;-)
Any IDEA?