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 / Power Automate Create ...
Power Automate
Unanswered

Power Automate Create HTML Table - rows staggered against colums?

(0) ShareShare
ReportReport
Posted on by 10

I'm after some help - 

I have an array that I am converting to a HTML table:

simon66_1-1694151551862.png

The issue is that the values are staggered across the rows -instead of ending up with one row I end up with three rows:

simon66_0-1694151430971.png

Appreciate any advice on where I might be going wrong.

Thanks

Simon

 

Thanks

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi Simon,

     

    Pls share the output of array variable which is the input of "Create html table". The array should be like this:

    [
    {
    "Program Name":"Prg1"
    },
    {
    "Program Name":"Prg2"
    },
    {
    "Program Name":"Prg3"
    }
    ]

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • simon66 Profile Picture
    10 on at

    Hi Manish - 

    Array looks like:

     

    [
      {
        "Program Name": "Galambany"
      },
      {
        "Program Risk": "This event leads to that consequnce"
      },
      {
        "Program Issue": "Example issue number one"
      }
    ]
     
    Thanks 
    Simon
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi Simon,

     

    Pls modify the flow to get the values in the array variable in the following format:

    [
    {
    "Program Name":"Galambany",
    "Program Risk":"This event leads to that consequnce",
    "Program Issue":"Example issue number one"
    }
    ]

    When you pass this array to "Create HTML table" you will get a row with multiple columns.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • simon66 Profile Picture
    10 on at

    Thanks Manish - this problem is that there will be multiple risks and issues for each program - so my flow is looping over risks (and adding to the array) then looping over issues and adding to the array for each issue - putting it in the one bracket as per you solution results in the program name being repeated... any thoughts on this scenario?

    Simon

     

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @simon66 

     

    Could you pls share the screenshot(s) of the loops in edit mode? Let me have a look.

     

    Thanks

  • simon66 Profile Picture
    10 on at

    simon66_0-1694498736354.png

    Thanks Manish - appreciate your help with this...

     

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @simon66 

     

    Thanks for sharing the screenshots. I have prepared a sample flow for you that will help you in designing the required flow.

     

    Here, I have set up one to many relationship (using lookup column) between Program Risk and Program Issue tables or entities.

    1. Firstly, initialize an array variable 'ProgramIssues' that holds required objects:

    ManishSolanki_0-1694506711152.png

     

    2. Next, get the records from 'Program Risk' table using "List rows" action:

    ManishSolanki_1-1694506775967.png

     

    3. Now, iterate program risk records and using another "List rows" action get the issues for each risk. We will use filter rows parameter to filter out the required issues for a risk:

    ManishSolanki_2-1694506948923.png

    _crc76_programrisk_value eq '@{items('Apply_to_each')?['crc76_programriskid']}'

    Pls use the logical name of the column in the above expression to compare with the unique identifier of parent row. The pattern should be like _<col logical name>_value:

    ManishSolanki_4-1694507172077.png

     

    4. Add another "Apply to each" action for iterating the issue records and collect all required fields in the array variable using "Append to variable" action:

    ManishSolanki_5-1694507303577.png

     

    5. Finally, pass the variable to "Create html table" action to get the desired table:

    ManishSolanki_7-1694507441126.png

     

     

    Output obtained after flow execution:

    ManishSolanki_6-1694507421821.png

    I hope this will give you some idea to modify your flow to get the desired output.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

     

     

     

  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at

    You can solve that with without any loops by using xPath:

     

    Chriddle_1-1694514400645.png

     

    To make things easier for me, I skip the Get items and save the data in 2 Compose actions:

    Risks:

     

    Spoiler (Highlight to read)
    [
     {
     "Name": "PN0",
     "Issue": "PR0"
     },
     {
     "Name": "PN1",
     "Issue": "PR1"
     },
     {
     "Name": "PN1",
     "Issue": "PR10"
     },
     {
     "Name": "PN1",
     "Issue": "PR11"
     },
     {
     "Name": "PN2",
     "Issue": "PR2"
     },
     {
     "Name": "PN3",
     "Issue": "PI3"
     }
    ]
    [ { "Name": "PN0", "Issue": "PR0" }, { "Name": "PN1", "Issue": "PR1" }, { "Name": "PN1", "Issue": "PR10" }, { "Name": "PN1", "Issue": "PR11" }, { "Name": "PN2", "Issue": "PR2" }, { "Name": "PN3", "Issue": "PI3" } ]

    Issues:

     

     

    Spoiler (Highlight to read)
    [
    	{
    		"Name": "PN0",
    		"Issue": "PI0"
    	},
    	{
    		"Name": "PN1",
    		"Issue": "PI1"
    	},
    	{
    		"Name": "PN2",
    		"Issue": "PI2"
    	},
    	{
    		"Name": "PN3",
    		"Issue": "PI3"
    	},
    	{
    		"Name": "PN3",
    		"Issue": "PI30"
    	},
    	{
    		"Name": "PN4",
    		"Issue": "PI4"
    	}
    ]
    [ { "Name": "PN0", "Issue": "PI0" }, { "Name": "PN1", "Issue": "PI1" }, { "Name": "PN2", "Issue": "PI2" }, { "Name": "PN3", "Issue": "PI3" }, { "Name": "PN3", "Issue": "PI30" }, { "Name": "PN4", "Issue": "PI4" } ]

     

    The Select action takes all names from Risks and Issues

    union(
    	xpath(
    		xml(json(concat('{"root":{"name":',outputs('Risks'),'}}'))),
    		'//Name/text()'
    	),
    	xpath(
    		xml(json(concat('{"root":{"name":',outputs('Issues'),'}}'))),
    		'//Name/text()'
    	)
    )

    and maps this as following:

    Name:

    item()

    Risks:

    join(
    	xpath(
    		xml(json(concat('{"root":{"name":',outputs('Risks'),'}}'))),
    		concat('//name[Name="', item(), '"]/Issue/text()')
    	),
    	decodeUriComponent('%0A')
    )

    Issues:

    join(
    	xpath(
    		xml(json(concat('{"root":{"name":',outputs('Issues'),'}}'))),
    		concat('//name[Name="', item(), '"]/Issue/text()')
    	),
    	decodeUriComponent('%0A')
    )

    Since there are multiple risks and issues per name, they are joined with a line break.

     

    The Create HTML table simply takes the body of the Select:

    @{body('Select')}

     

    The final table looks a bit awkward, but you can fix this with some styles (but this is another topic 😉)

    Chriddle_0-1694514241197.png

     

  • simon66 Profile Picture
    10 on at

    Thanks for the input - when I try to use:

     

    {
    item(),
    union(
    xpath(
    xml(json(concat('{"root":{"name":',outputs('Risks'),'}}'))),
    '//Name/text()'
    ),
    xpath(
    xml(json(concat('{"root":{"name":',outputs('Risk'),'}}'))),
    '//Name/text()'
    )
    ),
    join(
    xpath(
    xml(json(concat('{"root":{"name":',outputs('Issues'),'}}'))),
    concat('//name[Name="', item(), '"]/Issue/text()')
    ),
    decodeUriComponent('%0A')
    )
    }

     

    I am getting an invalid json error - appreciate any advice on where I might be going wrong with this approach.

     

    Cheers, 

     

    Simon

     

  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at

    You must not use a single JSON. Each code block in my proposal is a seperated expression.

    Pls check the screenshot where to place them.

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