You are viewing limited content. For full access, please sign in.

Question

Question

Inconsistent boolean token conditionals?

asked on May 8, 2019

I have a workflow that updates a record in one of our databases. It takes each column as an input parameter and is intended to be invoked from another workflow. The table it's updating has several FK constraints, integer-type Yes/No flags, and bit-type True/False flags, so I'm doing a fair bit of input validation before the actual update activity.

My concern here is with the bit columns. I have a Conditional Parallel with a branch for each, to have a default "false" value set just in case an empty value is provided to the workflow (or some other unforeseen issue happens and the value isn't a True/False):

Each branch has the same conditions (the first one has some extra conditions, but those aren't relevant) - Basically, "if the value isn't true or false":

Seems simple, but I'm getting inconsistent results. The last two times I've run the workflow, for example, I've given blank values to the input params. The first run, these conditionals worked as expected:

An empty value does not equal True or False, so the child activity ran:

The second run, however, ran differently with the same input params:

It counted an empty input parameter as true! To be clear, both runs had the same empty values for the booleans:

Although I don't have the examples at hand, I have run into this happening on at least one other workflow in recent weeks... I just wasn't sure about it. But now that I'm building this workflow, I'm able to run tests to confirm that I'm not crazy.

So am I missing something here? I know that SQL Server will accept any non-zero (or non-"false") value for a bit column as 1 (or "true"), but that wouldn't explain the inconsistency here. I have defaults set for the input params, and I know this isn't likely to happen in production, but I like to be safe.

In a semi-related sidenote: Is it not possible in workflow to test whether two boolean tokens are equivalent?

0 0

Replies

replied on May 17, 2019

What I am seeing is that if you leave the defualt value for a boolean parameter blank, then condition evaluation seems to treat it as "true".

Are you invoking this workflow from another one? What tokens does that one use to set the values for the input tokens?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.