Hello,
I have written a rule in which I query certain parameters. However, now and then it comes to NULL values.
So e.g. if(x<NULL) does not work and it leads to errors.
First I have tried:
if(X.state < Y). If Y is a NULL value = error
Then I tried:
if(X.state == NULL || X.state < Y) hoping that would work, but it runs into the same error.
I know in SQL there is the IsNull function that replaces the NULL value e.g.:
if(IsNull(X.state,0)<Y).
Is there something like that here too? How can I realize that any NULL values are reliably caught?
Okay, then I guess I’ll have to take the code apart piece by piece.
Was hoping to get around that since the code already has quite a few lines
But thanks for now!
You didn’t say what language you are writing rules in and the examples here are ambiguous. Could be Rules DSL, could be JavaScript. Rossko57’s code is definitely Rules DSL.
There actually is a one liner where you can test for NULL or UNDEF in the same comparison by checking the state’s class. In Rules DSL