cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TesDA
Continued Contributor
Continued Contributor

Select is Duplicating Rows within Apply to Each from sql get rows

For some reason my flow is creating duplicate rows from within a select statement (image below).

 

The get rows (sql) isn't duplicated (I checked the  output). It seems to duplicate the number of times the apply to each is running - so if its running 10 times - then there are 11 rows (with the header).

 

Flow.jpg

 

Example: Flow2.jpg

 

Thanks!

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User
Dual Super User

The select data operation works on the whole array to select columns from the array.  It shouldn't be included inside an Apply to each that processes every row in the array.  Just move your select outside the Apply to each and you should be fine.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
fchopo
Super User
Super User

Hello @TesDA 

Could you share the output of the Get Rows SQL Action (Get Main) ?

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Pstork1
Dual Super User
Dual Super User

The select data operation works on the whole array to select columns from the array.  It shouldn't be included inside an Apply to each that processes every row in the array.  Just move your select outside the Apply to each and you should be fine.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
TesDA
Continued Contributor
Continued Contributor

@fchopo 

This is the first and second rows. Let me know if you need more. There are a total of 10 records (0 to 9).

 

Flow3.jpg

TesDA
Continued Contributor
Continued Contributor

@pstork  - I need to capture only the rows applicable to that specific run, so that I can send an email with only that row's data. Do you know how I would edit the flow to make sure I can attach just that subset (if that makes sense). Do I do another get rows on the same table?

Pstork1
Dual Super User
Dual Super User

If you aren't already filtering the Get Rows down to the set of Rows you want to report on then you should add a filter array after the get rows and before the Selected (Data Operation).  Don't confuse the Select you are using with a SQL select statement.  They aren't the same thing.  If you are looking for a SQL Select then you want the Execute a SQL Query V2 action, not the Select action.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (4,241)