Question regarding for each loop in ADF

Kenaniah Santhosh 6 Reputation points
2024-07-23T04:50:32.59+00:00

I'm trying to create a new pipeline in ADF and my requirement is as follows. I have a table 'abc' in my database which contains a list of table names in it. Now, I want to execute a stored procedure which is written in such a way that it checks the data in each table(table names present in abc) and returns 0 or 1 based on the counts in those tables. Now, through ADF, I want to call the stored procedure for all the tables present in abc sequentially.

Then, based on the output for each table, I want to proceed with the next step. Lets say first table 'table_1' has some data in it and the stored procedure returns 1. Then, I want to execute a particular soap api inside which I will use the first table name 'table_1'. This soap api also has to be called for all the tables sequentially.

I want to understand how I can parameterize the the table name and create a loop

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,666 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nandan Hegde 32,336 Reputation points MVP
    2024-07-23T05:21:05.4233333+00:00

    You can follow the below flow :

    Look up activity : Select * from abc (Note: this should contain less than 5k rows as that is the limitation of lookup activity)

    Then use this output as input to the for each activity.

    Within for each activity :

    use script activity : to trigger the stored procedure and you can pass item().tablename assuming tablename is the columnname of your table abc ; basically it would pass the table names value dynamically for every iteration

    then use if activity to test the script activity output and if true , use Web activity to trigger the API


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.