alternative to "nested if" statements
Anyone have an alternative in a Workflow to bypass a bunch of nested If statements? And not use the "Flow Chart" modules.
I have 7 choices for a user in a form. All binary radial buttons and can only pick one. The cascading value then gets passed to the "Query & Zoom" type style.
I am hoping to avoid tons of nested queries inside IFs. Is this a use case for some other fun "Control Flow" options?
0
-
I've never heard of a 'binary radial button'. Do you mean a Radio Button?
This looks like a typical case to use a Switch or Flow Switch activity.0 -
We commonly do what you are describing but there is an issue with the Radio Buttons. Radio Buttons are independent of each other in Workflow 4, so you will never get away from the If statements. What we do is after the Display Form, we create a text variable and check each radio button (if radio button is true) then we set the variable to the name of the Radio Button. That variable is then passed into a Switch. Hope that helps.
Though we recommend if possible, switch to Workflow 5. It is so much better to develop in that Workflow 4.0 -
I forgot about the fact that radiobuttons have separate result values. But there's a workaround: - Make sure the Radio Buttons have a logical Argument Name, for instance the same value as the ID (RadioButton1, RadioButton2, etc)
- Instead of linking the output values to separate variables, use the Display Form's 'Form Results' property
- To get the Argument Name name of the selected radiobutton, do this:
formResults.First(Function(kv) kv.Key.StartsWith("RadioButton") AndAlso kv.Value.Equals(True)).Key- Use the result of that function in a Switch activity
0
Please sign in to leave a comment.
Comments
3 comments