Default case in a boolean switch

Hi all,

I’ve build a process that clicks on a radio button pair (yes or no) based on an in argument of type boolean.

I want to skip this process in the event the argument is passed in null/default. However, a boolean switch appears to be running into the true/false cases instead of using the default “do nothing” case. I’d rather avoid nested if statements, so is the only solution to use a string as a faux-boolean argument?

Thanks!

If you’re using a flowchart try the Check True or Check False check point then just have it evaluate for if the argument is null. Should be fairly simple to take it from there.

I’m using a switch, not a flow switch. Additionally, the issue appears to be with the arguments coming in. I would expect if they came in as nothing or were left to default then they would be nothing or default in the workflow, but they are being turned to false.

Honestly I would probably just either use two nested if-statements, or a flow chart with two decisions.
I would probably prefer the latter as the condition that skips everything else is really easy and pretty to look at when working with flowcharts.

Neither of those options work as there are 3 options, and the third - nothing, isn’t passing into the workflow correctly.

Can you share your workflow?

Does this help at all? What the Use Case for a Switch vs Flow Switch - #2 by aksh1yadav

This used the nested IF statement approach and ensures the default/null value is acted on accordingly.

SwitchCase.xaml (5.8 KB)

edit: I uploaded a version that uses string values instead on Int32 on the case activity

But null isn’t being pulled into the workflow correctly,

Is this what you need?

image
No selection

image
Output is the default case

Perhaps I’ve not explained myself too well.

I have two worrkflows:
The first performs an activity to select a series of yes/no radio buttons (or do nothing if not specified).
The second workflow is where I am making changes to records and in the case a radio button isn’t true, this is checked before continuing by invoking the first workflow. In this case I send the in argument for this setting as true. I do not want to change the other settings, so the other in arguments are left to the default value (which should be nothing).

However, when I run the second workflow, and the first is invoked, the arguments that are not defined are passing in as false.

This is my issue - It is not triggering the default case in my switch (true- set true, false - set false, default - do nothing) because it is going down the false branch. I had assumed this was an issue with using boolean type in a switch, but further digging makes me think the argument in is the issue.

My solution appears to be - use strings and tell my users it’s null/true/false only.

I also note the same issue regarding integer arguments (this pull in as 0).