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 / Hide empty rows in htm...
Power Automate
Unanswered

Hide empty rows in html table when the field in Microsoft Forms is left blank

(0) ShareShare
ReportReport
Posted on by 3

Dear community,

I wish to build a flow in MS Power Automate to achieve the following process:

1- A supplier submit a questionnaire in MS Forms

2- The flow generates a table in PDF format with the answers 

 

Requirement:

The output table contains 2 columns with 2 cells each row: description, answer from MS Forms.

If a question is no answered in MS Forms the corresponding row shall be hidden in the PDF table. 

 

The problem:

If the field is left blank in MS Forms my conditional code returns the row with description and the second cell empty.

 

This is my code in compose:

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid black;
padding: 8px;
text-align: left;
}
</style>
</head>
<body>
<h2>Supplier Information</h2>
<table id="data-table">
<tr>
<td>Organisation Name</td>
<td>@{outputs('Get_response_details')?['body/r31ca776ad00b4a1187c2e59746d22d72']}</td>
</tr>
<tr style='display:"& If( !IsBlank(Address), "" ,"none")&"'>
<td>Address</td>
<td>@{outputs('Get_response_details')?['body/r6b682c933fde4fdca20d468608885f52']}</td>
</tr>
<!-- Add more rows for other fields from your form -->
</table>

<script>
// Function to hide rows if specific fields are empty
$(document).ready(function () {
$("#data-table tr").each(function () {
var cell1 = $(this).find("td:eq(1)").text().trim(); // Change 1 to the column index of the field you want to check
if (cell1 === '') {
$(this).hide();
}
});
});
</script>
</body>
</html>

 

I believe the code does not work because the cell in the row I am trying to hide is not truly empty but contains the dynamic content in red above.

 

This is my output if I leave the address empty in MS Forms

 

DavidCi_1-1695839627964.png

 

The code above was generated by ChatGPT. 

 

Please could you help?

 

Thank you in advance.

David

 

Categories:
  • David_MA Profile Picture
    15,587 Super User 2026 Season 2 on at

    You cannot really do what you are asking since your table is two-columns. You cannot hide a cell within a table. The best you could do is create the cell with no borders, but your table would look funny.

     

    If you want to do this, add a Compose action and use an expression to check if the response to the question is empty. If it is, return nothing, and if it is not, return the HTML code for the row. For example:

     

    if(empty(outputs('Get_response_details')?['body/r82b78a91ba40497aa2bc108bbe279afb']), '<td></td>', concat('<td style="border: none;">', outputs('Get_response_details')?['body/r82b78a91ba40497aa2bc108bbe279afb'], '</td>'))

     

     

    David_MA_0-1695841278415.png

    Use the output of the Compose action in place of "<td>@{outputs('Get_response_details')?['body/r6b682c933fde4fdca20d468608885f52']}</td>" in your code.

  • DavidCi Profile Picture
    3 on at

    thanks @David_MA 

     

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
Mohsin Ali Profile Picture

Mohsin Ali 355

#2
11manish Profile Picture

11manish 336 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard