Azure Data Factory - Where is For Loop to loop on a counter

Jay 536 Reputation points
2021-11-04T15:35:26.32+00:00

I want to create a pipeline that runs a store procedure which populates a table with 0 to 10 rows, I then want to select each row and email the row (logic app) 1 row per email.

I'm stuck on the For Loop...

My sql table has a row number so I can do a lookup: SELECT max(RN) as MaxRN FROM [dbo].[table]
And I thought I could set a variable as 1 and just loop until variable greater than lookup value but I can't see how to do this easily in for each.

Also within the loop I was going to get the sql table row to email by simply: SELECT Value1,Value2 FROM [dbo].[table] Where RN = variable

Is this possible what I'm attempting?

146573-image1.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,477 questions
0 comments No comments
{count} votes

Accepted answer
  1. svijay-MSFT 5,201 Reputation points Microsoft Employee
    2021-11-07T07:59:49.33+00:00

    Hello @Jay ,

    Thanks for the question and using MS Q&A platform.

    My understanding is that you'd like to loop in values from 1 to 10 in a variable.

    You could make use of the Range Function

    147047-image.png

    In the Foreach Activity

    147048-image.png

    You could Reference each value of the iteration using the Current Item.

    147083-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

0 additional answers

Sort by: Most helpful