web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How can I display a li...
Power Automate
Unanswered

How can I display a list of rows in an email body from SQL without using Apply To Each?

(0) ShareShare
ReportReport
Posted on by 10

I have a Power Automate flow, that uses Execute a Stored Procedure (v2) to get a list of Rows from the database based on some logic that occurs server-side.

 

The list contains one column of 5 rows, that I need to place into the body of an e-mail, but when I select the ResultSet (column name), it automatically defaults to using Apply to Each, which means it takes the 5 values and sends 5 emails to the user for each row with one unique value in each e-mail.

 

Basically, I want the e-mail to send the row as this:

 

Hi, here are your 5 references:

123456

234567

345678

456789

567890

 

How can I achieve this?

 

Thanks

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at

    You can look at using Create HTML table and pass in your ResultSet. Or use a Join and join with a <br> tag since the email body will output as HTML.

  • benshikari Profile Picture
    10 on at

    I had looked at that, but I really need the values as text. Is there a way to join the text results together as a string using <br> like you say?

  • grantjenkins Profile Picture
    11,063 Moderator on at

    join(YOUR_RESULTSET_FIELD, ‘<br>’)

  • benshikari Profile Picture
    10 on at

    Thanks for your help with this.

     

    Unfortunately, I can't select the resultset field as a dynamic content item within the formula. If I manually type it in, it returns as blank when used in the fx formula.

     

    The other result sets return a string like:

    {"case_ref":30000590},{"case_ref":30003393},{"case_ref":30007703},{"case_ref":30013185} 

    Is it possible I could extract these numbers manually within the string?

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Are you able to show your JSON to understand exactly what's within the ResultSet object? Does it look like the following:

    {
     "ResultSet": [
     {
     "case_ref": 30000590
     },
     {
     "case_ref": 30003393
     },
     {
     "case_ref": 30007703
     },
     {
     "case_ref": 30013185
     }
     ]
    }

     

    If so, you can use a Select then Join. The expressions in my Select are below. You would likely be able to just select your ResultSet from dynamic properties - in this example I'm getting the data from my Compose.

    //From - this would come from your data source
    outputs('Compose')?['ResultSet']
    
    //Map
    item()?['case_ref']

    grantjenkins_0-1676673719254.png

     

    And the output from Join.

    grantjenkins_1-1676673768221.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard