I am trying to use two forEach activities to iterate on subfolders of folders with parameters to get metadata of subfolders. I have forEach1 and forEach2 with their own items array. Within the second for loop I need to combine both for loops' item() in a Metada activity to access my dataset like @item1()@item2(). Is this possible?
You can't nest a ForEach loop inside another ForEach loop (or an Until loop). Design a two-level pipeline where the outer pipeline with the outer ForEach loop iterates over an inner pipeline with the nested loop.
Because ADF doesn't support nested ForEach activities, we'll need to create two pipelines: one to return all datasets within a project and another to subsequently return all tables within each dataset. The first pipeline will iterate over the second pipeline, which will iterate over the tables.
Data movement activities, Data transformation activities, and Control activities are the three types of activities in Azure Data Factory and Azure Synapse Analytics.
Figure 4: Add Foreach Activity in ADF Pipeline Configure the foreach activity click on add dynamic content and use the expressions to get the output of getmetadata activity and list of files. This will be an array of all the files available inside our source folder which we wanted to iterate over upon.
Nested foreach activity is not allowed. But you could use an execute pipeline activity inside the foreach activity. And in the nested pipeline, you could have another foreach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With