a!localVariables( local!test: {}, if( condition: local!test > 0, valueIfTrue: { "My First Message", "My second Message", "My third message" }, valueIfFalse: "My false Message" ) )
Discussion posts and replies are publicly visible
Hi deans4069 ,
The if() function docs explain this behavior: "However, if the value parameters have shorter lists than the condition, the index is not maintained. Instead, each item is returned in order (and repeats if necessary)."
Should this be updated since condition can be a list of boolean and not just the data type boolean?
Interesting point - I can bring it up with the docs team!
I think this is dangerous as the behaviour of an if() with multiple conditions is hard to predict and combined with variable length values lists becomes erratic at best.
April Schuppel if the docs team is updating this, I suggest to include a clear warning about the edge cases and that the if() function clearly is meant to be used with a single condition only.
a!match seems to handle it better IMO. If you pass it a list, the condition never triggers.
a!localVariables( local!test: {}, a!match( value: local!test, whenTrue: local!test > 0, then: { "My First Message", "My second Message", "My third message" }, default: "My false Message" ) )