Template Expressions

Review the following:

  • Template Expressions are used to insert dynamic data into your export files. It even allows you to perform actions to your data using predefined functions.
  • Expressions only recognize text between {{}} or {%%} as expression code. Anything not surrounded by those tags is treated as-is.
  • iMIS GL Processor Cloud uses a derivative of the Liquid template language. Read a more in-depth introduction on the Liquid template language here.
  • iMIS GL Processor Cloud also uses the Scriban library to implement the Liquid template language. Read a more in-depth documentation on the Scriban library here.

Objects and Fields

Liquid evaluates and replaces any text inside {{ and }}.

For example, if you want to insert the value from the Amount field, you could write the following expression:

Template Output
{{ export[“Amount”] }} 125.99

Filters and Functions

Functions or methods in other languages are referred to as filters in liquid. Filters can be used for a variety of things, such as converting a string to uppercase, formatting a date, performing math computations, and lots more.

Filters are called by adding a pipe character | between the field and the filter. For example,

Input Template Output
01/31/25 {{ export[“Date”] | format(“yyyy-MM-dd”) }} 2025-01-31
500.55 {{ 0 | minus: export["Credit"] }} -500.55
01-1100-111 {{ export[“GL Account”] | split: “-” last }} 111

Whitespaces

When writing expressions, whitespace is generally preserved outside of the curly braces. by contrast, any whitespace contained between {{ and }} is generally ignored.

Note: In the following table, the · symbol will represent an invisible space character.

Template Output
·{{·message·}}·· ·Hello··
{{····message·|·downcase··}} hello
····{{message}} ····Hello
msg = ·{{·message·}}· {"msg": "·Hello·"}

These examples show that anything outside of {{...}} is preserved, which can potentially add unwanted whitespace to your data.

To have more control of whitespaces in your expressions, the use of {{- … -}} or {%- … -%} tags can be used. This will suppress all whitespace within the brackets.

Template Output
{{-···· message ····-}} message

Conditional Operators

Conditional operators evaluate and replaces any text inside {% and %}.

For example, if you wanted to evaluate a property value and use different outputs based on the evaluation you could write:

Input Template Output
Credit {% if export["Type"] == "Debit" %}

D

{% else %}

C

{% endif %}
C

Comments

Comments may be added to the expressions to provide a description or notes.

For example, if you wanted to add comments to an expression you could write:

Template Output

{{ amount }}

{% comment %}

This displays the amount of the transaction.

{% endcomment %}

99.99