How to use Pick Branch?


I am trying to get Pick & Pick Branch to work.

I would like to trigger a branch by using a variable and 1 “Is Match” per Pick Branch. “Is Match” outputs a Boolean result, so I thought it would work.
It does not. It always goes with the left-most branch.

The documentation is very limited so I would like to know what I can use to trigger the branches?

Thanks in advance, Mats.


Hi @MatsO
Welcome to UiPath community.

How to use?
See, Pick activity contains a collection of PickBranch activities, where each PickBranch is a pairing between a Trigger activity and an Action activity.
You can use Element exist, Image exist as a Trigger like this

In your case,
If you’re using “is match” as a trigger, you need to first conform that your “is match” pattern works fine.
And, When using Pick, the branch that executes is the branch whose trigger completes first.
They says, all triggers execute in parallel but yes, I also observed that it’s from left to right.

Then your left-most ‘is match’ always gives boolean=true,

So I’ll suggest you,

  1. recheck Is match’s pattern and it’s output (boolean value) by giving different inputs.
  2. You can use flow decision OR nested if otherwise.

I hope this will help you :slight_smile:

1 Like

Hello samir, and thank you for your reply!

Since I didn’t get it to work properly, I tried a very simple test. It still runs the left-most, even though the “Is Match” is false.

Left “Is Match” highlighted:

As you can see, the TestVar that is assigned “123456”.
The left-most “Is Match” tries to find “abc” which should be false.
The right-most “Is Match” tries to find “345” which should be true.

However, the left-most branch always executes.
I’m sorry, but I can’t attach the .xaml, but the flow is very simple, as the pictures above shows.

1 Like

hey @MatsO
Its giving you correct output :slight_smile:
I’ll explain…

As I said before

Take one example here, and follow these steps:

  1. Use Image Exist activity as your trigger in both of those branches
  2. Indicate them with two different images (put Expected image in right-most branch for better testing)
  3. In action section put message box accordingly.
  4. and run the program.
    It’ll give you correct output (with right-most message box)

Because when you run the workflow, all triggers starts executing in parallel but right-most trigger will complete first (because left-most trigger is still searching for the image).

So in your case both triggers completes their execution at the same time.
1st is getting boolean value as False and 2nd is true (you can check it by putting boolean variable.ToString in their message boxes)
SO, again the main point is whose getting what value is not important here, whose trigger completes first is important, and

because of this your left-most branch executes every time (In your case)

I hope you understand what I meant. :slight_smile:


Hi samir!

Thank you very much for explaining this to me.
I thought the trigger was something that expected output “true” or “false”.
Instead the “trigger” is only which “trigger-sequence” finishes first.
So the “image exist” works, not because one of them finds the image (output=true), but in reality, it’s the timeout of the other events that delays those branches from triggering.

That was not at all what I expected from a trigger.

Thank you for clearing this up for me. Much appreciated!


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