Format Helpers

OL Connect provides a number of Helpers to format a value that is the result of an expression.

A "Helper" is a function that can be called in an expression.

Example: {{dateLong DueDate}}

In this example, dateLong is the Helper, and DueDate is the name of a data field that contains a date. The expression returns the date, formatted as a long date, e.g. February 23, 2022.

Note: The rules of the current locale also influence the way the data is formatted; see Locale.

To change the format of the output of an expression, simply type the name of a Helper in the expression. Which Helpers work depends on the type of the data.

This topic lists the available Helpers that can format a value by data type.

Note: The names of these Helpers are case sensitive. For example, "upperCase" works, but "uppercase" does not.

Text Helpers

These are the Format Helpers that can be used with text.

  • lowerCase transforms all characters to lowercase.

  • upperCase transforms all characters to uppercase.

  • properCase transforms the first character of each word to uppercase and all other characters to lowercase.

Number Helpers

The following Format Helpers work with numbers, i.e. data fields of the type Currency, Float and Integer.

  • currency formats a number as an amount of money, with a currency symbol.
    Optionally, you can specify a custom pattern. Put the pattern after the name of the data field, and enclose it in double quotes.

    Example: {{currency Total "#.0"}}

    For available patterns, see Number patterns.

  • currencyNoSymbol formats a number as a currency whilst omitting the currency symbol.

  • number allows you to enter a custom format mask. For example, the pattern 000000 means that the number should count six digits; leading zeros are added to numbers shorter than six digits. For an overview of pattern symbols see Number patterns and http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html. The custom pattern will only work if the actual value of the field can be converted from a text to a number.

    Example: {{number Total "#.0"}}

  • grouped formats a number using a thousands separator.

Note: Which currency symbol and which thousands separator are used depends on the Locale; see Locale.

Note: In output, spaces in a number or amount of money are transformed into non-breaking spaces to ensure that it is not split onto different lines.

Date and time Helpers

The following Format Helpers work with dates. A date can contain a date and time.

Note that this requires the data field to be of the type Date. These Helpers don't work with plain text.

  • date formats a date object using a custom pattern. Put the pattern after the name of the data field, and enclose it in double quotes.
    The custom pattern may consist of pattern letters, separating symbols and quoted text, for example: "MMMM dd, yyyy"; see Date and time patterns.

  • dateLong formats a date as long string representation, for example April 1, 2022.

  • dateMedium formats a date as medium string representation, for example Apr 1, 2022.

  • dateShort formats a date as short string representation, for example 4-1-2022.

  • dateTime formats a date and time object using a custom pattern. Put the pattern after the name of the data field, and enclose it in double quotes.
    The custom pattern may consist of pattern letters, separating symbols and quoted text, for example: "yyyy.MM.dd G 'at' HH:mm:ss z"; see Date and time patterns.

  • dateTimeLong formats a date and time as long string representation, for example April 1, 2022 12:00:00 EDT AM.

  • dateTimeMedium formats a date and time as medium string representation, for example Apr 1, 2022 12:00:00 AM.

  • dateTimeShort formats a date and time as short string representation, for example 4/1/22 12:00 AM.

  • time formats a time using a custom pattern. Put the pattern after the name of the data field, and enclose it in double quotes.
    The custom pattern may consist of pattern letters, separating symbols and quoted text, for example: "'at' HH:mm:ss z"; see Date and time patterns.

  • timeLong formats a time as long string representation, for example 12:00:00 EDT AM.

  • timeMedium formats a time as medium string representation, for example 12:00:00 AM.

  • timeShort formats a time as short string representation, for example 12:00 AM.