IF TBSalesLine.FINDSET THEN BEGIN REPEAT IF … then begin IF TBSalesLine.Quantity <> 0 THEN BEGIN .. TFLineMod2 := TRUE; END; END ELSE BEGIN … TFLineMod2 := TRUE; END; IF TFLineMod2 THEN INTSetLineNo2 := TBSalesLine."Line No."; UNTIL TFLineMod2 OR (TBSalesLine.NEXT=0); END;Does the NEXT statement occurs if the TFLineMode2 is true?
Answers
Hi
Yes, it will occur because Navision resolve every statement of a boolean condition, even if first statement is false and implicity the result will be false.
You can test this with a small program:
resultfalse is a function like:
If navision does a complete calculation, it will show "ResultFalse checked" message.
If navision will exit immediately at the first statement ("false"), wil not display the message.
On Nav2009Sp1 Classic, i see the "ResultFalse checked" message.
Bye
Matteo
OR condition implies that if the first condition is ok, the second one is not executed at all (in C# works like this, but if i'll find the code i wrote in NAV i'll post it)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Hi
If you change my test like :
"ResultFalse" function will be called even if the first statement is TRUE and there isn't reason to check the second statement.
Matteo
i have to find that piece of code ](*,) , because i'll probably have to correct it.
thanks!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
OR also can imply that all factors must be checked - for example: FALSE OR FALSE OR FALSE OR something.
It has nothing to do with how NAV checks logical conditions. As you were told, and checked on your own NAV always checks all part of logical expression.
That's why I never write code like this example: but in such a case always like this: This warrants that fastest conditions are checked first, and GET is executed in latest step.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
It was not correct in Pascal (C/AL is based on Pascal) and there were compiler options in Pascal to enable the "partial condition evaluation" or how it was named to work in this way...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog