Hello,
Im trying to “nest” an if statement in a SET but I get [undefined]
{{$if($node[“Code”].json[“day_today”]==“7”,“Its seven!”,$if($node[“Code”].json[“day_today”]==“6”,“Its six”,“Its another number”) )}}
what am i doing wrong? Should that work?
the below works:
{{$if($node[“Code”].json[“day_today”]==“7”,“Its seven!”,“Its another number” )}}
Thank you
Try using a ternary operator
{{$json["day_today"] === "7" ? "Its seven!" : ($json["day_today"] === "6" ? "Its six" : "Its another number")}}
that might not be exactly correct, but ternary operator is the way to do this i believe.
3 Likes
Thank you so much for the above…
how would i go about putting an “OR” in there?
if number is 7 OR 5 then “number is not even” else if number is 0 then “zero” else “number is even”
Thank you
The or operator would be ||
. So to check if something is five or seven your expression should be something along these lines:
{{$json["day_today"] === "5" || $json["day_today"] === "7" ? "Its five or seven!" : ($json["day_today"] === "0" ? "Its zero" : "Its another number")}}
system
Closed
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.