Working though an array of values in a subprocess

Hi all

I invoke a subprocess from the process page that types in to some fields on a webpage and then clicks enter.

To use this subprocess I have an array of strings which contain ‘invoice numbers’. The number of strings in this array can vary from one queue item to the next. The array just contains these invoice numbers and nothing else.

When I have finished with the subprocess, I’m struggling to write the code that checks if there are any more values left in the array (therefore meaning I need to invoke the subprocess again.)

I believe that I need to count how many values are in the array and then set up a counter system and in a flow decision check if the current count is less than the total count of values in the array. If that’s the case I invoke the subprocess again.

I don’t know how pass in the next item from the array (the next ‘invoice number’). If the array is called ‘invoicenumbers’ what is the code to make sure the ‘next’ invoice number is passed in to the subprocess each time?


1 Like

—use a WHILE LOOP with condition like this
counter < arrayvariable.Count
Where counter is a variable of type int32 with default value as 0 defined in the variable panel
—if this condition is true it will go to THEN apart where we can invoke the workflow
—still being inside the THEN part next to this Invoke workflow file activity use a assign activity like this
counter = counter +1


Pass that array variable as input to a FOR EACH activity and inside that loop use Invoke workflow and to pass the array value in current iteration mention as item.ToString as it holds the current array element
So that the workflow will called and the array element will be passed one by one till all the elements have been processed

Cheers @jordrowley

1 Like

thanks @Palaniyappan I’ve gone with option 2 :slight_smile:

1 Like

Hey @Palaniyappan random question. We connect Ui path to Microsoft DevOps so we can store and share code etc. With this in mind, do you know anything about what the NuGet file is for?

I didnt get this clearly
kindly come again pls

Hey @Palaniyappan, thanks for replying. I’ve found this article which has helped :slight_smile: What is NuGet and what does it do? | Microsoft Docs

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