Reputation: 85
I have an issue rearding the passing of more than one array parameter. I was able to do a "for each" cycle to execute my array parameter "SPPATH", but unfortunately I can pass only one, here is my code:
{"SPPATH":"@{item()}","SPFOLPATH":"@{pipeline().parameters.SPFOLPATH}","updsppath":"@{pipeline().parameters.updsppath}","Storageacct":"@{pipeline().parameters.Storageacct}","sapath":"@{pipeline().parameters.sapath}","saoppath":"@{pipeline().parameters.saoppath}"}
I want to pass "updsppath" also in the array because my output is on different locations, is it possible to do that, if so, how?
thanks in advance
Upvotes: 0
Views: 630
Reputation: 11234
I have reproduced the above and able to iterate multiple arrays inside ForEach.
For this the length of the all arrays should be same.
Use another array for indexes of these.
For Sample I have two array parameters like below.
I have created another array for index like below.
@range(0,length(pipeline().parameters.arr1))
Give this index_array
to ForEach.
Create a res
array variable in pipeline and inside ForEach, use append variable
with the below dynamic content.
@json(concat('{"arr1":"',pipeline().parameters.arr1[item()],'","SPFOLPATH":"',pipeline().parameters.arr2[item()],'"}'))
After ForEach if you look at variable result (for showing here I have assigned to another variable), it will give you the desired JSON.
Result:
You can use this procedure to generate the desired array of objects and pass it to the logic apps as per your requirement.
Upvotes: 1