Parallel For Each

Hi Team,

Can you please explain the parallel for each loop use in a workflow.

Thanks & Regards,
Priya

1 Like

Probably this will shed some light

3 Likes

Example For Parallel For Each activity…
In this workflow,the Parallel for each type can be only accepted by System.Collection.Generic.iEnumerable(Integer) data type value…
I declare a variable like new_array contains value of {1,2,3,4}
After executing in parallel For each It will Display like {4,3,2,1}

Parallel.xaml (13.5 KB)

Regards,
Poovarasan Guna

1 Like

Another example of parallel for each, using monitor events for dynamic images
Use Case - Images loaded from a folder, monitor every image for click

For Each - Only the last image in the array will be monitored
Parallel For Each - Every image in the array will be monitored

Note: Ensure you use UIAautomation.Activities 19.3 or above

ParallelForEach.zip (120.4 KB)

7 Likes

Thanks…!

great answer it works :slight_smile: very useful info.

Hi Deeksha_Bhat
Unable to open our .xaml File…I am facing the below issue…

Hi Deeksha_Bhat
Please can you reply and help me out to solve the issue…

Can you open other projects normally?
That error usually appears when your Studio gets automatically updated and your robot doesn’t. Have you tried restarting your computer to see if the updates get synchronized?

Hi Mateus_Cruz

I was not able to open the .xaml files that i have downloaded from online…remaining files i was able to open

Hey, I am trying to use Parallel for each file type in a directory. I am using a long running workflow and hence creating queues in Orchestrator. I need to use the name of file as Queue reference. How do i provide the file name as reference as we know that variables which has broader scope do not work properly? When assigning the name of file to a variable, outside the parallel for each activithy only fetches the first file name it processed.

I’m trying to use this activity also, which seems to be simply abandoned or not properly polished.

For days I haven’t been able to type ANYTHING inside the Foreach [INPUT], as it gets automatically ERASED when I click outside the activity.

I opened a support ticket days ago. I event provided a video of what I described, so the odd behaviour/bug is clearly visible. Instead, the reply is nonsensical rubbish which has nothing to do with my question:

“The First input does not change. That is only there to build the iteration through the items from the IEnumerable system collection used in the second input.”

and then a broken link icon, as images in the customer support ticketing system NEVER HAVE WORKED, since we started using it 3 years ago. For god’s sake!

It’s been more than 24 h since I replied and still waiting for a follow up.

Now today, by mere miracle, it has allowed me to enter “item” inside the textbox so it seems I finally able to use this activity! Nevertheless, when copying all the workflow I had on a regular For each, I get an error in a “Continue” activity:

“Activity can only be placed inside a loop, a Trigger Scope or next to a trigger.”

OMFG! Is this for real? We cannot use a simple Continue inside a For Each activity, no matter if it’s parallelized?? Is this true or is it simply that they forgot to add this exception to allowed activities a “Continue” can be placed in??

Please don’t tell me to convert the sequence to an “If..Then..Else” one; mine is already complex and the Continue is placed inside a Catch clause, and any other suggestion goes against good practice.

Furthermore, as usual, WE DON’T GET ANY REAL DOCUMENTATION ABOUT THE ACTIVITY, NO EXAMPLES, NOTHING. Look at this:

Activities - Parallel for each

Is anything in there other than we can already see in the activity card?

Any mentions about how to control the degree of parallelization? For example, how many “threads” can the loop be parallelized in? Is it using real threads at all? Any mention about not being able to use “Continue”? Any example??