does anyone know if it's possible to fit two condi...
# suitescript
u
does anyone know if it's possible to fit two conditions in a Freemarker
<#if>
statement? for context, i've created a simple xml template in a Suitelet and am trying to print out a
Customer Payment
record onto this xml template. So far it works, but the output is currently printing out a lot of items in the
apply
sublist, but I only want the one item with a value in the
amount
column *(which is also the only item in the record's sublist anyway). i guess a follow-up question would be if there is a way to filter out items that get filled in by the
<#list>
feature? I'd appreciate any and all input.
d
Probably want to share your question to #C466X49JB yes, you can have two conditions in a single
<#if>
. See if, else, elseif and Logical operations if you want to filter for only items in the apply sublist that have a value in amount you can either: •
<#list>
the whole apply sublist and only print when
<#if apply.amount?has_content && apply.amount gt 0>
• use the ?filter builtin for sequences to pre filter your
#list
. Something like
<#list record.apply?filter(x -> x.amount?has_content && x.amount gt 0) as apply>
1
the ?filter built-in is a newish feature, and that's the way I'd go
u
thanks for the heads-up re: #C466X49JB. i rarely spend much time here unless I'm really stumped so I didn't know it was a thing until now. and thank you for the filter suggestion. I was aware of the first bullet point but wasn't sure about how to format it without a specific example.