Skip Switch Cases On Every Loop


I have a sequence looped 3 times that includes a switch with 3 cases. I want on each loop to choose the first case, then on the next loop, skip the current one and go to case 2 and then repeat the sequence for the last time and choose case 3. How to assign a skip for each item? I have done a demo with each case containing a message box.

Download it here:
Quick Testing.xaml (9.5 KB)

Hi @private_matter,

What packages are you using on your sequence you’ve attached? Can’t see your activities with default packages

Bit confused about your actual question (not sure if it’s because I can’t see your Xaml or not). If loop 1 requires case 1, loop 2 requires case 2, etc. then you could just make a single sequence of the steps you need for each loop?

Hello @william.coulson

I’m using the latest packages for all the activities.

I know that I can set the number of times to 3 in the Repeat number of times activity and it will do what i want. Execute case 1, then case 2, then case 3. However, in my real project, underneath the Switch activity there are other activities than need to be executed. So when doing case1, then other activities executes, on the second loop, the bot needs to skip case 1 and goes to the next case key.

Anyways, here’s a screenshot of the demo.

Hi @private_matter ,

As we could view from the Screenshot that the value for the Switch Case is CurrentItem.

But also observing that the Repeat number of Times is only looping once. (i.e 1)

In that case, we would not require the Repeat Number of Times Activity.

After which, we can use counter variable as the variable for the Switch Case.

So After every loop, the counter increases by one, thus selecting the other cases in the Switch.

Please let us know if this is not the expected solution you require. Also please explain as to why the Repeat Number of times is executed only once.

1 Like

Hello @supermanPunch,

Yes you’re right. The repeat number of activities is not needed and I fixed it by replacing the CurrentItem variable with the Counter variable and all is working now. Thanks! Marked as solved. :slight_smile:

1 Like

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