question

Jay-8106 avatar image
0 Votes"
Jay-8106 asked Jay-8106 commented

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

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
image1.png (10.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SathyamoorthyVijayakumar-MSFT avatar image
0 Votes"
SathyamoorthyVijayakumar-MSFT answered Jay-8106 commented

Hello @Jay-8106,

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




image.png (6.4 KiB)
image.png (8.3 KiB)
image.png (23.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Perfect, thank you!

0 Votes 0 ·