user3473023
user3473023

Reputation: 1

NetSuite Advanced PDF Template - Freemarker syntax

I have a custom body field custbody_deposit_number that may have 2 values separated by a comma. I need to understand the syntax of the freemarker ?split built in. This is what the freemarker site says about ?split:

<#list "someMOOtestMOOtext"?split("MOO") as x>
- ${x}
</#list> 

Prints

can anyone provide help on how to implement my field in the ?split syntax?

Upvotes: 0

Views: 4243

Answers (2)

user3473023
user3473023

Reputation: 1

this is how we finally solved this issue:

<#if record.custbody_deposit_numbers?has_content>
    <#list record.custbody_deposit_numbers?string?split(",") as x>
    <tr>
        <td align="center">${x}</td>
        <td align="center">
            <#assign depositdate = record.custbody_deposit_dates?string?split(",")[x_index]>
            ${depositdate}
        </td>
        <td align="right">
            <#assign depositAmt = record.custbody_deposit_amount?string?split(",")[x_index]>
            <#assign depositAmt1 = depositAmt?number>
            ${depositAmt1?string.currency}
        </td>
    </tr>
</#list>

Upvotes: 0

ddekany
ddekany

Reputation: 31122

Like this:

<#list custbody_deposit_number?split(',') as x>
  - ${x}
</#list>

You may also want to remove space around the commas, either via ${x?trim} or using ?split(r'\s*,\s*', 'r')

Upvotes: 1

Related Questions