Advanced Template Snippets
To help you create advanced templates, you can use the following snippets:
Handling Payments by Batch
You can define criteria for subdividing payments into groups. The subdivisions can be traversed one after the other to produce an output payment file that handles payments by batch. The following example illustrates grouping payments by entity type.
Example
Payments:

And the following entity banks:

Template
<#assign vendorPayments = []>
<#assign employeePayments = []>
<#list payments as payment>
<#assign ebank = ebanks[payment_index]>
<#if ebank.custrecord_2663_parent_vendor == payment.entity>
<#assign vendorPayments = vendorPayments + [payment]>
</#if>
<#if ebank.custrecord_2663_parent_employee == payment.entity>
<#assign employeePayments = employeePayments + [payment]>
</#if>
</#list>
<#OUTPUT START#>
**VENDOR PAYMENTS**
<#list vendorPayments as payment>
Amount:${payment.amount}
</#list>
**EMPLOYEE PAYMENTS**
<#list employeePayments as epayment>
Amount:${payment.amount}
</#list>
<#OUTPUT END#>
Output

Displaying all Transaction IDs per Payment
A payment can contain multiple transactions. To display all the transactions, use the transHash
data. See transHash.
Mapping of payment files to transactions:

Template
<#OUTPUT START#>
<#list payments as payment>
Payment ID: ${payment.id}
<#list transHash[payment.internalid] as transaction>
Transaction ID: ${transaction.tranid}
</#list>
</#list>
<#OUTPUT END#>
Output

Looping Through a List of Payments
The payment index is used inside the loop to get the correct entity and entity bank under a particualr payment. You can use the following snippet as a starting point when looping through payments.
<#list payments as payment>
<#assign entity = entities[payment_index] >
<#assign ebank = ebanks[payment_index] >
<#-- do processing here -->
</#list>
Related Topics
- FreeMarker Template Library for Electronic Bank Payments
- Functions
- Data
- Working with Advanced Templates
- Defining Start and End Tags in Advanced Templates
- Including Fields from NetSuite Search Results in Advanced Templates
- Advanced Template Tips and Tricks
- Creating Custom Payment File Templates
- Creating a New Custom Payment File Template