RE: Advanced PDF print statement when a condition is met

Using advanced pdf, I am trying to modify a picking sheet to print a statement when {shipcomplete} is Yes. I am using the <#if> but have issues when the field is null.

I tried the following

<#if record.shipcomplete?has_content>

<#if record.shipcomplete == “Yes”>

SHIP COMPLETE

</#if></#if>

When I do so, I receive the error below.

If the failing expression is known to legally refer to something that’s sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??

I am not familiar with the myoptionalvar and do not know how to incorporate it into the picking sheet.

Any help will be greatly appreciated.

MidwestUser Rookie Asked on August 7, 2023 in Other.
Add Comment
6 Answers

Thanks for your insight.  I have made the following adjustments.

<#if record?exists && record.shipcomplete?has_content && record.shipcomplete == “Yes”>
<td>
SHIP COMPLETE
</td>
</#if>

The template saves without an error, but I receive the “unexpected error has occured” when I attempt to print the picking sheet.  Any thoughts?

Rookie Answered on August 8, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.