An Azure service for ingesting, preparing, and transforming data at scale.
In addition to @VINODH KUMAR
You can transform the result set into a flat array using a ForEach activity and an Append Variable activity in your Azure Data Factory (ADF) pipeline.
I tried to replicate the scenario and successfully ended up with the expected result.
I took the sample data in SQL database as follows:
I have followed the following steps:
This pipeline executes a SQL query to retrieve BranchId values from the Branches table, iterates over the results, appends them to an array variable, and then stores the final array in another variable.
Run Query to Fetch BranchId - The RunQuery activity executes:
SELECT BranchId FROM Branches;
ForEach Activity to Extract and Append BranchId - The ForEach1 activity processes BranchId values one by one.
Items:
@activity('RunQuery').output.resultSets[0].rows
Inside ForEach - Append Variable activity stores each BranchId inside the BranchIds array.
Store Final Output in Result Variable - After ForEach1 completes, the Set variable1 activity assigns the final BranchIds array to the Result variable.
Expression:
@variables('BranchIds')
Expected Output - After execution, the Result variable should contain:
[9133, 9087, 9055, 9077]
Please refer to the below gif.
I hope this information helps. Please do let us know if you have any further queries.
If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.