Hi All, I have a transaction body field that is a...
# advancedpdf
r
Hi All, I have a transaction body field that is a "Currency" field on the Invoice and I want the Advanced PDF to be dynamic to do the following: If the field is empty, do not display on the Advanced PDF If the field has a value, display the field. Can anyone advise?
c
You need an if statement like
Copy code
<#if field?has_content>
<!-- display value here -->
</#if>
👍 1
it may have to be something like
Copy code
<#if field gte 0>
<!-- display value here -->
</#if>
Its been a minute since i've done PDFs but you need one of these if statements
p
The first reply from creece is correct, replace field with the id including prefix, so if the field id is message then:
Copy code
<#if record.message?has_content>
${record.message}
</#if>
r
If the field has both a <TH> and <TD> Where do we put that IF statement? I did try the "?has-content" approach yesterday within the <TD> section before posting here but it did not work
c
most likely the TD as you most likely want to display a header or label but no value? If you don't want the TH to show up at all put it around the TH
p
you need on both TH and TR/TD if its a whole column you want to show/hide, otherwise just the TR/TD as mentioned
if you have some code already, show it and I can add what's missing
r
I figured it out guys 🙂 My field is a currency field, it kept bypassing the "?has_content" because it always had a value of 0.00 technically. I switched the code to be "!= 0.00" instead of "?has_content" and it works 🎉 Thank you for the suggestions and speedy responses
2