How to Read and write array Output from activity(row outputs) as input to foreach loop in Azure Data Factory?
1 Answer
How can i set the value of new_values_array in variables inside foreach loop Eg(1,2,3,4) i need to set v=1,q=2,etc like that
To get the Result array like a=1,b=2, you need another array for the letters.
Here I am using 3 arrays and generating the result array with append activity.
numbers_array -> for the numbers [1,2,3,4](This is your output array from previous activity).
letters -> for the letters ["a","b","c","d"].
index_array -> extra array of indexes for using two arrays inside Foreach using their indexes. @range(0,length(variables('numbers_array'))) results [0,1,2,3].
new_values_array -> Result array in append activity inside ForEach.
numbers_array:

letters array:

index_array:

In ForEach, check the Sequential and give the index_array as @variables('index_array') because by using this array we are getting the values of multiple arrays inside ForEach.

Inside ForEach use append and give the below dynamic content for new_values_array.
@concat(variables('letters')[item()],'=',variables('numbers_array')[item()])

Result in another array(Optional step, only for showing output here):

Output after pipeline execution:

@item()syntax within the For Each activity. I would need to see some sample data and expected results for a more complete answer.