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

The code above was generated by ChatGPT.
Please could you help?
Thank you in advance.
David