Loop through for each take value then break then loop to get the second value

i have 3 for each loop i need to take the first value from first loop then go to the second loop take first value then go to third loop take first value , then return to get the second value from each loop , how can i do this ??


my data example like this and i have 3 of this loop

Hi @rpa13
are all collections had same elements ?

Hi, @rpa13 ,

I’m not sure I totally understand what you are trying to do, but here is a quick process I made that loops through 3 arrays and adds each item to a data table as it goes.
Is this kind of like what you are trying to do?


DataTable
Animals

Hi,

Instead of using 3 loop use 1 loop.
If the total number of values in 3 collection is same then
first create int variable->arrayLength=array.length
2nd) create 2nd variable int Counter->0 initialize it
3rd) use while loop and with the condition Counter<=arrayLength
4rd) inside loop create three variable
FirstCollectionVariable1=firstCollectionArrayname(counter)
secondCollectionVariable1=2ndCollectionArrayname(counter)
thirdCollectionVariable1=3rdCollectionArrayname(counter)
Now add them into datatable through Add data Row activity
5th)increment the counter variable. Counter=Counter+1

hope this will work

1 Like

orders":[{"order":"123"},{"order":"456"},{"order":"789"}]]
numbers":[{"num":"7897"},{"num":"4565"},{"num":"3435"}]]
data like this collections with elements

@ghazanfar @Joe.Matuch can you supply me with workflow please

Here it is, @rpa13 . I have not tried @ghazanfar 's solution before, but I will do that now. That is a more elegant solution, though I think mine will work similarly (though possibly more slowly).
Main.xaml (10.5 KB)

1 Like

@Joe.Matuch
but my data is jobject
like this
orders":[{“order”:“123”},{“order”:“456”},{“order”:“789”}]]
numbers":[{“num”:“7897”},{“num”:“4565”},{“num”:“3435”}]]

Hi,

I have created a code for the above mentioned logic by me. I have tested it. It is working fine with one loop.

Hope this will work for you.Sequence6.xaml (12.2 KB)

@ghazanfar , I think that solution will only produce entries that have all the first entries, all the second entries, all the third entries, etc. My understanding is that @rpa13 wanted the first entry in the array with all the different combinations of entries from the other arrays.

I will take a look at changing my solution to work with the data the way you have it formatted, @rpa13 . So your data is a dictionary with strings as both the keys and values?

I think he needs data like this way…

This is array not dictionary look there are no keys in it.
How we split the values to get required value like this way…

orders":[{“order”:“123”},{“order”:“456”},{“order”:“789”}]]
assign FirstArrayValue1=orders(index)
assign FirstArrayValue1=split(FirstArrayValue1,“:”)(1)
it will return 123

dd
i need my data to be like this
in addition my data in jobject and it generate dynamic each time

@NIVED_NAMBIAR @Joe.Matuch @ghazanfar
any help please for this problem tt

can you share your XAML with us?

test.xaml (15.1 KB)
here is and my data i take in jobject by api call
example of data i get in json object like this
"material":[{"sku":"0345"},{"sku":"0692"},{"sku":"0630"}]

@ppr do you have any idea?

So lets assume yourJson(“material”) Value is a JArray with the JObjects: {“sku”:“0345”},{“sku”:“0692”},{“sku”:“0630”}

And any other array will do have the same length

Parse the arrays with e.g.
arrJMaterial = JArray.Parse(yourJson(“material”).toString) or any other methods
Prepare a datatable with the structure you do need - Var dt

then construct the datarows - 1 row many cols

grafik
For each TypeArgument is Int32
x = Enumerable.Range(0,arrJMaterial.Count)
grafik
grafik

So Just complete it for the other cols

Write date afterwards and not within loop with write range using the datatable

Can doiut with linq or classiscal

can you supply xaml file please

incomplete protype starter help here:
test.xaml (12.5 KB)

In case of you need more help please provide your JSONObject

Source value must be a JToken i got this error