Combine switch and if activity (condition using value assign in switch activity)

Hi, I am doing a find max and min value.
I thinking that the workflow can be simplify. Cause the workflow is similar for both of it, just symbol and initial value change.
Is there any ways to simplify the process?

I tried the to combine the switch and if activity
For example,
user dialog to select max or min

switch that if select max, vCon = “vList(index) > vMax”
switch that if select min, vCon = “vList(index) < vMin”

Then in the if activity, condtion = vCon

But it stated that disallow conversion from string to boolean.

Or is there any way to combine the workflow of finding max and min value
(ps: if separate, both can, but the workflow is too long ald)

Keep it simple…
Trying the ‘fancy solution’ by integrating several flow controls might work eventually, but in the long run might cause issues when you need to make alterations to your process at some point.

The length of a workflow usually is irrelevant, unless you plan to use huge amounts of data or have multiple document or UI interactions you want to reduce. Performance wise there is little gain for average enterprise usage. Results count, not the number of code lines, other than the same complexity arument at te beginning of my reply.


  • Make one small workflow for find max value
  • Make one small workflow for find min value
  • Invoke these in a simple if/then/else branch based on your input choice.

It might seem like redundant code this way, but you create dedicated workflows (or activities if you export them to libraries) that are low maintenance, and easy to reuse in other situations.

ok, thanks for your suggestion.

Last time at work, they request me to simplify the code, make it shorter(Not rpa). Then, for this, I thought that I should also do so.

I will keep it simple next time.

Thanks again for your reply.

Well short is nice of course, don’t use code you don;t need, but not at the cost of maintainability (legibility).
It’s a fine balance, and personal preference definately weighs in here.

Avoiding best practices cliches, my guiding star usually is that the code should be legible like a story. So that if you have no process knowledge at all, reading the code by using proper activity titles and variable names, you still can read it like a book and (roughly) understand the process that the code executes.

But again… a personal preference (and one that I dictate towards my team in code reviews)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.