abas-ERP: condition throwing unexpected error

255 views Asked by At

I have a FO-program that throws an error when it approaches this line:

.continue ERR1 ? F|defined(M|yhnum) & M|yhnum > 10

The error is

M|yhnum: not found

Why does this happen? I thought it wouldn't happen if I checked if the variable is defined before accessing it, but it doesn't seem like it worked

1

There are 1 answers

0
Breeze On BEST ANSWER

The problem here is, that FO doesn't use short circuit evaluation. This means that it will always check if M|yhnum is bigger than 10, even if it is not defined. Obviously, this will fail if it is not defined.

From the documentation:

This means that a Boolean expression will be completely evaluated even if the final result can already be seen from the intermediate result. This is significant in connection with defined().

Use F|condexpr to manually achieve short circuit evaluation

.continue ERR1 ? F|condexpr(F|defined(M|yhnum), M|yhnum > 10, G|false)