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 / Extracting Column Name...
Power Automate
Unanswered

Extracting Column Names where status is pending and include all in a HTML Table

(0) ShareShare
ReportReport
Posted on by 6

Hi all!

 

I have a sharepoint list with numerous columns where the status can be either "Completed" or Pending". I'm looking to extract the column name for al the column's where the status is "Pending" and then include that in a HTML table. The column names would need to appear in a list format perhaps separated by a comma, I have attached a photo for reference. 

 

Thanks in advance!

Screenshot 2024-04-29 101505.png
Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at

    Hi @CharlieR1995 ,

     

    You could add a 'Filter Array' action before the 'Create HTML Table' action to filter on the Status column. 

    vbofengmsft_0-1714383438074.png

     

    Best Regards,

    Bof

  • CharlieR1995 Profile Picture
    6 on at

    Thank you, although it isnt just one column status I need to look at it is about 10! I would need to filter by all that equal pending 

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

    This approach requires a loop, but on the other hand is quite flexible when it comes to column names and numbers.
    If the column names contain special characters, these must be XML decoded, otherwise they will look a bit strange in the HTML table.

    Chriddle_0-1714397025569.png

    Input data is the following JSON in a Compose (You can add as many status properties as you want)

    Spoiler (Highlight to read)
    [
     {
     "Project": "Proj0",
     "Status0": "Completed",
     "Status1": "Completed",
     "Status2": "Completed",
     "Status3": "Completed"
     },
     {
     "Project": "Proj1",
     "Status0": "Pending",
     "Status1": "Pending",
     "Status2": "Completed",
     "Status3": "Completed"
     },
     {
     "Project": "Proj2",
     "Status0": "Completed",
     "Status1": "Completed",
     "Status2": "Pending",
     "Status3": "Completed"
     },
     {
     "Project": "Proj3",
     "Status0": "Completed",
     "Status1": "Completed",
     "Status2": "Completed",
     "Status3": "Pending"
     },
     {
     "Project": "Proj4",
     "Status0": "Pending",
     "Status1": "Completed",
     "Status2": "Completed",
     "Status3": "Pending"
     }
    ]
    [ { "Project": "Proj0", "Status0": "Completed", "Status1": "Completed", "Status2": "Completed", "Status3": "Completed" }, { "Project": "Proj1", "Status0": "Pending", "Status1": "Pending", "Status2": "Completed", "Status3": "Completed" }, { "Project": "Proj2", "Status0": "Completed", "Status1": "Completed", "Status2": "Pending", "Status3": "Completed" }, { "Project": "Proj3", "Status0": "Completed", "Status1": "Completed", "Status2": "Completed", "Status3": "Pending" }, { "Project": "Proj4", "Status0": "Pending", "Status1": "Completed", "Status2": "Completed", "Status3": "Pending" } ]

    Apply to each

     

    {outputs('Compose')

     

     

    Select

    From:

     

    range(
    	1,
    	length(
    		xpath(
    			xml(json(concat('{"Root":', items('Apply_to_each'), '}'))),
    			'//*[text()="Pending"]'
    		)
    	)
    )

     

    Map:

     

    xpath(
    	xml(json(concat('{"Root":', items('Apply_to_each'), '}'))),
    	concat('name(//*[text()="Pending"][', item(),'])')
    )

     

     

    Compose 2

    Project:

     

    items('Apply_to_each')['Project']

     

    Pending:

     

    join(body('Select'), ', ')

     

     

    Create HTML table

     

    outputs('Compose_2')

     

     

    Chriddle_1-1714397215041.png

     

  • CharlieR1995 Profile Picture
    6 on at

    Thank you. The map JSON is coming up as Invalid and I cant figure out why

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

    This one?

    xpath(
    	xml(json(concat('{"Root":', items('Apply_to_each'), '}'))),
    	concat('name(//*[text()="Pending"][', item(),'])')
    )

    Do you get an error message? Otherwise show me a screenshot.

  • CharlieR1995 Profile Picture
    6 on at

    Screenshot 2024-04-29 165518.png

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

    This doesn't happen if you just put the expression into the map's input field.

    Check if there is anything else (e.g. space or line break). You can also check this in Code view.

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#3
David_MA Profile Picture

David_MA 270 Super User 2025 Season 2

Last 30 days Overall leaderboard