<#if record.custentity_md_amt_to_be_credited?ha...
# ask-stanley-ai
a
<#if record.custentity_md_amt_to_be_credited?has_content> <tr> <td style="border: 0.5px solid #000; padding: 4px;"> <b>Amount to be Credited</b> </td> <td style="border: 0.5px solid #000; padding: 4px;"> <b>${record.custentity_md_amt_to_be_credited}</b> </td> </tr> </#if> Why does this row still show when the field is empty? Modify the code to hide it when field is empty
c
AI generated answer (using internal Slack threads):
The row is still showing when the field is empty because the
has_content
method in FreeMarker checks if the sequence (string, list, etc.) is not null and has a length greater than zero. It doesn't check if the string only contains whitespace (spaces, tabs, newlines, etc.). To hide the row when the field is empty or contains only whitespace, you can use the
?trim
built-in function in FreeMarker to remove leading and trailing whitespace from the string, and then check if it has content. Here's how you can modify your code:
Copy code
html
<#if record.custentity_md_amt_to_be_credited?trim?has_content>
<tr>
    <td style="border: 0.5px solid #000; padding: 4px;">
        <b>Amount to be Credited</b>
    </td>
    <td style="border: 0.5px solid #000; padding: 4px;">
        <b>${record.custentity_md_amt_to_be_credited}</b>
    </td>
</tr>
</#if>
This will ensure that the row is hidden when the
custentity_md_amt_to_be_credited
field is either null, empty, or contains only whitespace. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830382824
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80719018
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805625081
Please provide your feedback on this answer.