I have this expression rule and I need to get the value of one of the keys based upon whether another key property is true or false, I have this but doesn't work:
a!localVariables( local!myDictionary: { { item: 1, active: true, description: "Widget", color: "Green"} ,{ item: 2, active:false, description: "another", color: "red"} }, if( fn!index(local!myDictionary,"active","") == true, fn!index(local!myDictionary,"color",null), "") )
To explain further: I would want to return the value "Green" from the key property color due to active property being true and not the value "red" because active property is false.
Discussion posts and replies are publicly visible
Hi
Here's the code:
a!localVariables( local!myDictionary: { { item: 1, active: true, description: "Widget", color: "Green" }, { item: 2, active: false, description: "another", color: "red" } }, local!myDictionary.color[fn!wherecontains(true,fn!toboolean(local!myDictionary.active))] )
Here's the result:
...and here's an explanation:
Hope this helps
Great explanation with the bullet points. I was not aware you could use functions within the square brackets and the reason why I may have missed something simple as this, but now I know! Thank you for the help!