So I had to do some complex workflows for a client. And you know MIMWAL is best for that.
Now I was going to use the Eq() built in function to do a comparison to see if the attribute is coming back is true. The attribute I was comparing to was a boolean. So in the workflow I used an update resource type and had an activity execution condition that if the attribute is true then run the update.
Naturally I tried this to being with
1 |
Eq([//Target/BooleanAttr],true) |
Umm, didn’t work. Should have matched and executed the WF. Tried various other ways
1 2 3 4 5 |
Eq([//Target/BooleanAttr],True) Eq([//Target/BooleanAttr],"true") Eq([//Target/BooleanAttr],"True") Eq([//Target/BooleanAttr],$true) Eq([//Target/BooleanAttr],1) |
On doing some debugging I saw that WAL was doing a string comparison to a Int64 type and coming back as a False match even on a (‘True’,’True’) condition.
Then tried something different
1 |
Eq([//Target/BooleanAttr],ConvertToBoolean(1)) |
Voila!! That worked. Well I don’t know if I did something or if this is the only way to do a boolean comparison in the Eq() function but hey it worked for me..
Mental note!!!
Edit: So as per comment below did some more testing and the following execution condition code worked 🙂 even with false value it looked for true.Â
1 |
ConvertToBoolean([//Target/BooleanAttr]) |
See.. I told you I did something wrong 🙂Â
2 Comments
Martin · 12/08/2018 at 12:30 AM
I think it is not necessary to use EQ()
Just use the boolean Attribute.
Like so:
Executioncondition = //Target/BooleanAttr
admin · 12/12/2018 at 2:56 PM
Thanks Martin. Doesn’t work just like that. You will get the error message
“The activity execution condition must be a boolean function. Consider wrapping your current condition inside a ConvertToBoolean() function.”
But then the following works
ConvertToBoolean([//Target/BooleanAttr])
Even with a false or null value it looks for true so all good 🙂
Thanks