Can't make a test condition envolving null to work


#1

1) Give a description of the problem
I have this condition on a piston:
if {$args.level} is {null}
that seems to evaluate to false wrongly

2) What is the expected behaviour?
When the piston is called with no args, that condition should evaluate to “true”.
I’ve tried several other combinations like if {level} is (nothing on the value).

3) What is happening/not happening?
log: Comparison (dynamic) null is (dynamic) null = false (2ms)

**4) Post a Green Snapshot of the piston!

5) Attach logs after turning logging level to Full

+0ms ╔Received event [Casa do Alto].execute = :b6799b2b229ca5ba869683926c6ad660: with a delay of 44ms
+43ms ║RunTime Analysis CS > 20ms > PS > 5ms > PE > 18ms > CE
+45ms ║Runtime (39180 bytes) successfully initialized in 5ms (v0.3.110.20191009) (44ms)
+46ms ║╔Execution stage started
+51ms ║║Cancelling statement #14’s schedules…
+59ms ║║Calculating (string) Casa do Alto: + (string) test >> (string) Casa do Alto: test
+1187ms ║║Executed virtual command sendEmail (1126ms)
+1201ms ║║Executed virtual command sendPushNotification (9ms)
+1209ms ║║Comparison (dynamic) null is (integer) 1 = false (2ms)
+1211ms ║║Condition #21 evaluated false (6ms)
+1215ms ║║Comparison (dynamic) null is (dynamic) null = false (2ms)
+1217ms ║║Condition #23 evaluated false (5ms)
+1218ms ║║Condition group #20 evaluated false (state did not change) (14ms)
+1221ms ║╚Execution stage complete. (1174ms)
+1222ms ╚Event processed successfully (1222ms)

Thank you!
ztp


#2

I’d try to use isEmpty($args.level) instead of testing for null


#3

I have found boolean() to work very well. It returns true if it contains any value or text (other than 0) and returns false if 0 or null.


#4

Thank you!!
The isEmpty() did the trick. And I’m sure boolean() would also work!
The what-seems-to-be-a-bug remains, though.