Functions

The Electronic Bank Payments SuiteApp uses the following functions in payment file templates.

Function Declaration

Description

buildEntityName(entity,isPrintOnCheckAs)

Builds the entity name

computeTotalAmount(payments,multiCurrency)

Adds all payment amounts

convertToLatinCharSet(data)

Converts a string into its Latin equivalent

formatAmount(amount,format,separator)

Formats a particular amount to be inserted into the payment file

getSequenceId(forTodaySequenceOnly)

Returns the raw sequence ID from search of the PFA record

removeEnding(data,removeString)

Removes the specified ending from a string value

setLength(data,length)

Sets the fixed length for a string value

setMaxLength(data,maxLength)

Sets a maximum length for a string value

setPadding(data,padSide,padChar,length)

Puts a padding to a string value

getCurrencySymbol(currencyName)

Returns the 3–digit ISO currency symbol for the specified currency name

getCountryCode(country)

Returns the two-letter country code for the cpecified country

getAmount(payment,multiCurrency)

Returns a payment amount considering multiple currencies, base currency, and bank currency

encloseString(str,maxLength,escapeChar,enclosingChar)

Encloses the specified string in between the specified enclosing character if it contains the specified escape character

getStateCode(state)

Returns the state code for the specified state. State code that will be retrieved depends on the Country set under the Company Information page. If the Country does not have states, the function will return a blank value.

buildEntityName(entity,isPrintOnCheckAs)

Builds the entity name of a vendor, customer, or employee.

Parameters
Returns
Example

Sample entity search result objects:

Block diagram showing example search results for two vendors and two customers.

Commands

The first set prioritizes the printoncheckas field and the second set does not.

          <#list entities as entity>
      ${buildEntityName(entity,true)}
</#list>
<#list entities as entity>
      ${buildEntityName(entity,false)}
</#list> 

        

Output

Printed output of the previous code sample. Printed output of the previous code sample.

computeTotalAmount(payments,multiCurrency)

Adds all payment amounts.

Parameters
Returns
Example

Sample payment search result objects for a single currency format:

Block diagram showing example search results (3 payments and 3 corresponding amounts).

Commands

          ${computeTotalAmount(payments)} 

        

Output

Printed output of the previous code sample.

convertToLatinCharSet(data)

Converts a string into its Latin equivalent.

Parameters
Returns
Example

Commands

Sample command output.

Output

Printed output of the previous code sample.

formatAmount(amount,format,separator)

Formats a specified amount to be inserted into the payment file.

Parameters
Returns
Example

Commands

          ${formatAmount(-100.50,"dec")}
${formatAmount(100.50,"noDec")}
${formatAmount(100.50,"decLessThan1")}
${formatAmount(-100.50,"truncDec")}
${formatAmount(-1000.50,"currency")}
${formatAmount(100.50,"dec",",")}

${formatAmount(1234.50,"currency",".")}
${formatAmount(0.50,"currency",".")}
${formatAmount(123.45,"currency",".")}
${formatAmount(1234567.89,"currency",".")}
${formatAmount(-1234567.89,"currency",".")} 

        

Output

Printed output of the previous code sample. Printed output of the previous code sample.

getSequenceId(forTodaySequenceOnly)

Returns the raw sequence ID from search of the PFA record.

Note:

This function can be used for EFT and Direct Debit transactions only. Currently, it is not available for Positive Pay transactions.

Parameters
Returns
Example

Sample PFA search results for yesterday:

Block diagram showing an example of raw sequence IDs returned for 3 PFA records (results for yesterday).

Sample PFA search results for today:

Block diagram showing an example of raw sequence IDs returned for 3 PFA records (results for today).

Commands

The first line gets the sequence ID for today only, and the second line gets the sequence ID covering all dates.

          ${getSequenceId(true)}
${getSequenceId(false)} 

        

Output

Printed output of the previous code sample.

For a sample implementation of this function, see Computing for the Sequence ID.

removeEnding(data,removeString)

Removes the specified ending from a string value.

Parameters
Returns
Example

Command

          ${removeEnding("abcdef","def")} 

        

Output

Printed output of the previous code sample.

setLength(data,length)

Sets the fixed length for a string value.

Parameters
Returns
Example

Commands

The following commands cover setting length of data with varying lengths:

          ***${setLength("abcde",3)}***
***${setLength("a",3)}***
***${setLength("a",3,"right")}*** 

        

Output

Printed output of the previous code sample.

setMaxLength(data,maxLength)

Sets a maximum length for a string value.

Parameters
Returns
Example

Commands

The following commands cover setting max length of data with varying lengths:

          ***${setMaxLength("abcde",3)}***
***${setMaxLength("a",3)}*** 

        

Output

Printed output of the previous code sample.

setPadding(data,padSide,padChar,length)

Puts a padding to a string value.

Parameters
Returns
Example

Commands

The following commands cover all padding options for data with varying lengths:

          ${setPadding("abcde","left","0",10)}
${setPadding("abcde", "right", "0", 10)}
${setPadding("abcde", "right", "0", 3)}
${setPadding("abcde", "left", "0", 3)} 

        

Output

Printed output of the previous code sample.

getCurrencySymbol(currencyName)

Returns the 3–digit ISO currency symbol for the specified currency name.

Parameter
Returns
Example

Command

          ${getCurrencySymbol("USA")} 

        

Output

Printed output of the previous code sample.

getCountryCode(country)

Returns the two-letter country code for the specified country.

Parameter
Return
Example

Command

          ${getCountryCode("Philippines")} 

        

Output

Printed output of the previous code sample.

getAmount(payment,multiCurrency)

Returns a payment amount considering multiple currencies, base currency, and bank currency

Parameters
Returns
Examples

Command

The following command is applied to the following sample scenarios:

          ${getAmount(payment)} 

        

Output

Printed output of the previous code sample.

encloseString(str,maxLength,escapeChar,enclosingChar)

Encloses the specified string in between the specified enclosing character if it contains the specified escape character

Parameters
Returns
Examples

Commands

          ${encloseString("abc^def",5,"^","@")}
${encloseString("abc^def",9,"^","@")}
${encloseString("abcdef",11,"^","@")} 

        

Output

Printed output of the previous code sample.

getStateCode(state)

Returns the state code for the specified state. This function is only applicable if Country is set to the United States on the Company Information page. Otherwise, the function will return a blank value.

Parameter
Returns

String containing the state code

Example

Command

          ${getStateCode("Alabama")} 

        

Output

Printed output of the previous code sample.

Related Topics

FreeMarker Template Library for Electronic Bank Payments
Data
Working with Advanced Templates
Advanced Template Tips and Tricks
Defining Start and End Tags in Advanced Templates
Including Fields from NetSuite Search Results in Advanced Templates
FreeMarker Template Library for Electronic Bank Payments
Advanced Template Snippets
Advanced Template Tips and Tricks
Creating Custom Payment File Templates
Creating a New Custom Payment File Template

General Notices