Advanced Template Tips and Tricks

Following are some tips and tricks to help you create advanced templates:

Removing CRLF (End of Line) Character

If you want to remove the CRLF or end of line character at the end of the output, use the FreeMarker tag <#rt>. For example, from the initial template:

Template

          #OUTPUT START#
ABC
#OUTPUT END# 

        

Output

Printed output of the previous code sample.

If you do not want to include a CRLF character to denote the end of a line in the output, place the #OUTPUT END# tag right after the last character in the template. Using the <#rt> FreeMarker tag:

Template:

          #OUTPUT START#
ABC<#rt>
#OUTPUT END# 

        

Output:

Printed output of the previous code sample.

Getting IDs from Select Fields

Accessing a select field from a record or search result returns the text of that select field. To get the ID, append .internalId when accessing the field.

Computing for the Sequence ID

Using the getSequenceId(forTodaySequenceOnly) function, you can create your own function to compute for the sequence ID on generated PFA records. Refer to a basic sample function using getSequenceId(true):

          <#function computeSequenceId>
    <#assign lastSeqId = getSequenceId(true)>
    <#assign newSeqId = lastSeqId + 1>
    <#return newSeqId>
</#function> 

        

At the end of the template, after the #OUTPUT END# tag, add a return for the last sequence ID that was used to update the sequence ID:

          #RETURN START#
sequenceId:${newSeqId}
#RETURN END# 

        

Debugging Template Errors

If the output file is not created successfully when using FreeMarker as the template engine, the Payment File Administration page shows a status of Processed with Errors, with details indicating that the system failed to render the payment file template.

This error is caused by one of the following conditions:

Related Topics

General Notices