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 Apps / Building a string with...
Power Apps
Unanswered

Building a string within ForAll

(0) ShareShare
ReportReport
Posted on by

I have an approval flow and I would like to display information within the approval. I have a sharepoint list full of data and I need to display each row of data in the approval flow. Ideally I would use Set() inside of ForAll() in order to build a string of the data I need and format it, but you cannot use Set() inside of ForAll()

 

Any ideas? Has anyone else had a similar dillema before?

Categories:
I have the same question (0)
  • Verified answer
    timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Anonymous

     

    One way to work around this problem is to Collect your data into a temporary collection inside your call to the ForAll function. You can then combine the rows with the Concat function to derive your complete string.

    The post that I answered here uses this exact technique. Hopefully, you'll get the gist of the formula that you would use.

    https://powerusers.microsoft.com/t5/Creating-Apps/Send-email-HTML-format-problem/m-p/121482#M2649

    The reason why the ForAll function doesn't support the Set function is because PowerApps can execute the iterations of a ForAll loop in parallel. There's no guarantee that PowerApps will loop over the source records in order, therefore, you might need to Collect a sort value to enable you to Concat your final string in the correct sequence.

  • Community Power Platform Member Profile Picture
    on at

    Thank you @timl 

     

    This solution worked very well. It would be nice to see a non concurrent ForAll implementation in the future.

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I have this exact same need, but am unable to look at your solution in the other post.    Is there any way you can share it here or is there another place it can be accessed?

     

    @timl

  • mdevaney Profile Picture
    29,989 Moderator on at

    @JR-BejeweledOne 

    Google Cache is your best friend in this situation...

    https://webcache.googleusercontent.com/search?q=cache:w2q7bAhHsg4J:https://powerusers.microsoft.com/t5/General-Discussion/Building-a-string-within-ForAll/td-p/121976+&cd=1&hl=en&ct=clnk&gl=ca

     

    I just typed this text string into Google

     

    powerusers 121482#M2649

    And looked at the Cached webpage instead

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I get the exact same error I get when trying to go to it from the link.  

     

     

     

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    That's a pain that my original post no longer exists 😞

    To summarise the technique, suppose you have a collection that looks like this and you want to convert this to an HTML table.

    image.png

     

    Here's the code to generate a table of results.

    Collect(outputTable,"<Table>");
    ForAll(Countries,
    Collect(outputTable, "<tr><td>" & name & "</td></tr>")
    ); Collect(outputTable,"</Table>")

    The result of this looks like this:

     

    image.png

     

    In an HTML control, you can then combine all of these rows into a single string with this:

    Concat(outputTable, Value)

    Hope that helps.

     

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Thank you for this.   Can you show me what the 'ForAll' line in the code would look like if I have a collection similar to below and I wanted to concat the Holiday and date together so the end result string would look like this:

      Christmas Eve   12/24/2019

      Christmas Day  12/25/2019

     

    Collection.jpg

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @JR-BejeweledOne 

    The formula would look like this:

    Collect(outputTable,"<Table>");
    ForAll(YourCollectionName,
     Collect(outputTable, "<tr><td>" & Name & "</td><td>" & Text(StartDate) & "</td></tr>")
    );
    Collect(outputTable,"</Table>")

     

  • iskguy Profile Picture
    402 on at

    I would love to see that solution, but it says I do not have access

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    The solution was to go to this link and look at the solution there.

     

    https://powerusers.microsoft.com/t5/Creating-Apps/Send-email-HTML-format-problem/m-p/121482#M2649

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard