cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Nested Loops from Sharepoint List to create Email

Hi There 

 

I am creating an automated email and while that works fine, i have added another variable to create sections within the email and now i have problems with repeating entries on a per section basis that shouldn't be there. please see the picture. any thoughts?nested items.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper I
Helper I

Re: Nested Loops from Sharepoint List to create Email

yesterday afternoon i finished it and it works nicely. Becuase the data can be blank coming in , i had to control for this. Also having done similar operations in other languages, i do think takes too long (it runs in 3 min) and that is only for 30 recordsdidit.png

View solution in original post

7 REPLIES 7
Highlighted
Super User III
Super User III

Re: Nested Loops from Sharepoint List to create Email

Hi @thuff 

 

Difficult to give an exact answer based on you screenshot without seeing the actual Get Item filters and other mapping in below steps.

 

Are you expecting to send one email at the end or for each area which contains all projects have separate email? Also what is the first and second loop you trying to iterate?

 

Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted
Helper I
Helper I

Re: Nested Loops from Sharepoint List to create Email

ah right - Perhaps this will help a bit but to answer your question, the idea is a single email with all entries but having them 'grouped' by email.

 

the first picture is showing the loop building the table for that group (area) .

 

the second picture shows the loop to build the table within the first loop for appropriate items within area (but that's not working well at the moment - every entry is repeating under area. you''ll notice if expressions  which is just set default value if the entry from SP is missing but for all intent and purpose those should just be considered individual SP items like owner, start, finish, title, lead, etc

 

nested items 2.pngnested items 1.png

 

 

Highlighted
Super User III
Super User III

Re: Nested Loops from Sharepoint List to create Email

Hi @thuff 

 

If you are looking to group a set of data why not using order by under Get Items the try to use the results in a HTML table.

 

See this blog will give some ideas:

 

Order by get items

https://powerusers.microsoft.com/t5/General-Power-Automate/How-to-use-order-by-get-items-insert-row-...

 

Create HTML Table or CSV

http://johnliu.net/blog/2018/4/how-to-use-select-to-simplify-create-html-table-and-create-csv-in-mic...

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted
Helper I
Helper I

Re: Nested Loops from Sharepoint List to create Email

So early on , i actually started with an HTML table but the formatting was very much like excel and the team wanted something that looked a little bit more refined (hence spinning the HTML with the sp list attributes). it works well but I'm not checking records against 'Area' and thus all the records are coming in for each when each area is fetched. For reference, my SP list looks a lot like the below and the output I've produced looks somewhat like the belowsplist.png

 

 

intended.png

Highlighted
Helper I
Helper I

Re: Nested Loops from Sharepoint List to create Email

after thinking about this a little bit an knowing the problem. i think the resolution lies in adding a condition and matching against the area value.  i will play with it and report back but open to course corrections as well

Highlighted
Super User III
Super User III

Re: Nested Loops from Sharepoint List to create Email

Hi @thuff ,

 

That's exactly I was about to write. Yes add a condition to check whether the Id changed or not. You probably need a temp variable here to compare from each iteration. Once value is changed then do the required formatting append to string and carry on. Think you are on the right track. If you need any help let me know.

 

Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted
Helper I
Helper I

Re: Nested Loops from Sharepoint List to create Email

yesterday afternoon i finished it and it works nicely. Becuase the data can be blank coming in , i had to control for this. Also having done similar operations in other languages, i do think takes too long (it runs in 3 min) and that is only for 30 recordsdidit.png

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (5,652)