In Blue Prism v5, there is a function IsFlag() which can be used to evaluate if a Data Item is of type Flag. Normally in case of e.g. a Number, the function IsNumber() will return False in case the Data Item is empty.

In my case (a Flag Data Item), the function IsFlag() does not return False when performing this expression in a decision stage.

Can someone explain me why and give a possible solution for this?

Solution that I already got from someone else: - Evaluate if Flag is set to True - Put Decision stage in Block - Add Recover/Resume stage and set value to False (as 'default' value) before actually evaluating the condition you want to evaluate.

1 Answers

2
Andrzej Kaczor On Best Solutions

The IsFlag() works in a different way than you think - it does not evaluate a variable by it's type, but by it evaluates a string that you pass to it.

If you're supplying it with text variable that says "Notflag", then as it's not "true" or "false" then the function returns "false".

If you're supplying the function with flag True, then it's first changed to text "True", then it's evaluated and it is in fact flag.

Finally, if you are supplying this function, with an empty flag, then it's first changed to empty string "", which of course it's not a flag. The same happens with empty number, date etc.

I think your solution is great. You could also experiment with using below codes, so that you have less boxes in your studio.

Trim([Flag])=""

or

[Flag] = True OR
[Flag] = False OR
Trim([Flag])=""