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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add text to a variable...
Power Automate
Answered

Add text to a variable inside a loop

(0) ShareShare
ReportReport
Posted on by 60

Hi,

 

I'm building a Flow and I vreated a Var to add text (an HTML Table).

First I add the Header, then inside a loop I add each line of the table and then I close the table.

 

Reze_0-1657104616757.png

Everything is created well but the text inside the loop isn't added.

 

<table style="border:1px solid #eeeeee;border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0">
	<thead style="background: #1C6EA4;border-botton: 2px solid #444444;font-size: 15px;font-weight: bold;color: #FFFFFF;">
		<tr>
 <th width="300">Nº Colaborador</th>
 <th width="300">Nome</th>
			<th width="300">Material</th>
			<th width="100">Tamanho</th>
			<th width="100">Quantidade</th>
		</tr>
	</thead>
	<tbody></tbody></table>

 

It should added lines between <tbody></tbody>.

Reze_1-1657104850509.png

And I can see it run the code (3 lines).

 

Does anyone knows whats appening?

 

Thanks

Categories:
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @Reze  Pls give us more details about your dynamic content inside <tbody> tag. To check this please use one compose and pass that dynamic content. Run your flow and see compose output. Pls share your output screen.

     

  • Reze Profile Picture
    60 on at

    @Hardesh15

     

    Thank you for the help.

    It really doesn't matter what's inside the loop. If I force some text inside the loop it does not show anyway.

     

    This is what I have in Appent to Variable "Concat('<tr><td>', items('ForEach_Equipment_for_Table')['ColaboratorNumber'], '</td><td>', items('ForEach_Equipment_for_Table')['UserName'], '</td><td>', items('ForEach_Equipment_for_Table')['Equipment'], '</td><td>', items('ForEach_Equipment_for_Table')['Size'], '</td><td>', items('ForEach_Equipment_for_Table')['Quantity'], '</td></tr>')".

     

    But if I replace the formula by some hard coded text like "Testing", it will not be added to the variable too. And the loop runs as you can see in the image.

     

    Reze_0-1657111111890.png

     

    Thanks

     

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @Reze  i am not seeing any dynamic content in your <tbody> tag. 

    Hardesh15_0-1657112442334.png

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • Reze Profile Picture
    60 on at

    @Hardesh15 

     

    That image you send is only to close the Body and the Table.

     

    if you look at my initial post in the second image it's the loop with a Append to Variable with some text

     

    So:

    • I Append to the variable the <table>, the <theader> and </theader> and open <tbody>
    • Then I have the loop that should append lines to the table
    • Them I close the </tbody> and the </table>

     

    Thanks

     

     

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @Reze This is wrong. You need to append it again rather than setting its value.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • Reze Profile Picture
    60 on at

    @Hardesh15

     

    I apologize my bad English.

     

    Sorry but I'm not understanding. I create the variable in the begining of the Flow and in the loop that I show you I only append to the variable.

     

    In the begining of the Flow:

    Reze_0-1657120717768.png

    Later I append this:

    Reze_1-1657120804860.png

    Notice the <tbody>.

    Then enter the Loop:

    Reze_3-1657120929597.png

    There are 3 rows for the Table. I just hard coded 'Testing'.

    Then close the Table:

    Reze_4-1657121023001.png

    And this is what I get:

    <table style="border:1px solid #eeeeee;border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0">
    	<thead style="background: #1C6EA4;border-botton: 2px solid #444444;font-size: 15px;font-weight: bold;color: #FFFFFF;">
    		<tr>
     <th width="300">Nº Colaborador</th>
     <th width="300">Nome</th>
    			<th width="300">Material</th>
    			<th width="100">Tamanho</th>
    			<th width="100">Quantidade</th>
    		</tr>
    	</thead>
    	<tbody></tbody></table>

    Nothing between <tbody></tbody>.

     

    Thanks

     

     

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @Reze I am understanding your issue. Rather than sharing screens in parts, can you share complete flow?. Please expand each action while taking screen. Use awesome screen shot extension that will help you take full page screen.

     Also can you hard code these closing tags in your mail and then test.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

  • Verified answer
    Reze Profile Picture
    60 on at

    @Hardesh15 

     

    Sometimes when you go to sleep and think in the problem you get the solution. Last night I figure it out and today it took me 5 minutes to correct the Flow. I needed another loop inside the first one.

     

    Thank you for your help.

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @Reze That's the reason i have asked for full flow screen because i have see loop inside loop lines in your post screens.

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

    @Hardesh /Gopenly.in

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 317 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 247

#3
Henil Profile Picture

Henil 117

Last 30 days Overall leaderboard