Formatting variable data

The way variable data are displayed in a template depends on two things. Firstly, the locale influences the way dates, times, numbers and currencies are formatted; see Locale. Secondly, there are functions to display a text in uppercase, apply thousands separators to numbers, etc.

The Text Helper Wizard (see Using the Helper Wizard) and the Text Script Wizard (see Using the Text Script Wizard) let you select a format or enter a format mask for each field that the script adds to the template. This topic describes the options that the wizards offer, depending on the type of field.
Reopen the Helper or script by double-clicking it in the Scripts pane.

In an expression, e.g. {{LastName}} (see Variable data in text: expressions), you can type the desired format function before the field name, e.g. {{uppperCase LastName}}. Functions in an expression are called "Helpers". For an overview of the available Format Helpers see Format Helpers.

The available formatting functions depend on the data type of the corresponding field in the Data Model. In a data mapping configuration you can set the data type of each field. When you open a data file or database without a data mapping configuration, all fields are text fields (fields of the type string).

When the software warns about a mismatch between the type of a field in the wizard and in the current data model, click the Refresh Types button to update field types in the wizard to match the types in the data model.

Formatting can also be applied to values in a Dynamic Table via the data-format attribute. See: Formatting values.

You could also format data in a script using the formatter; see Standard Script API.

Date

Dates in variable data can be displayed as long, medium and short dates with different time displays. There are quite a few presets, but you can also enter a custom format mask.

  • Custom Pattern opens a dialog in which you can enter a custom pattern the date (and, optionally, the time). The dialog shows an example of a date formatted according to the given pattern.
    Do not put the pattern in quotes. For possible patterns see Date and time patterns.

    Note: The Custom Pattern option is only available when the type of the field has been set to Date in the data mapping configuration and the field contains a valid date.

  • Default Date displays the date with the default pattern for the current Locale.

  • Short Date displays the day, month and year in two digits each, for example 01.04.16.

  • Medium Date displays the day and month in two digits each and the year in four digits, for example 01.04.2016. (This is also the value of the Default Date.)

  • Long Date displays the day as a number, the month's full name and the year in four digits, for example 1. April 2016.

  • Short Time displays a time in hours and minutes in two digits each, for example 00:00.

  • Medium Time displays a time in hours, minutes and seconds in two digits each, for example 00:00:00. (This is also the value of the Default Time.)

  • Long Time displays a time in hours, minutes and seconds in two digits each, and adds a time zone, for example 00:00:00 EDT.

  • Short Date/Time displays the date as a short date and the time as a short time, for example 01.04.16 00:00.

  • Medium Date/Time displays the date as a medium date and the time as a medium time, for example 01.04.2016 00:00:00 (This is also the value of the Default Date/Time.)

  • Long Date/Time displays the date as a medium date and the time as a medium time, for example 1. April 2016 00:00:00 EDT.

Font style

Text originating from variable data can be displayed in uppercase, lowercase or proper case.

  • Uppercase transforms all characters to uppercase.

  • Lowercase displays transforms all characters to lowercase.

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

Numbers and currencies

Numbers, and strings existing of digits, can be displayed as a number with a certain formatting or as an amount of money. There are a few presets, but you can also type a format mask.

  • Custom Pattern: 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. In the data mapping configuration, set the field type to Integer, Float or Currency. When you open a data file or database, all fields are text fields (fields of the type string).

  • Standard: displays the number with the default pattern and symbols for the current Locale.

  • Grouped displays a number with three decimal places and sets the thousands separator for the value based on the current locale; see Locale.

  • Currency displays a number as an amount of money, with a thousands separator and rounded to two decimal places, based on the current locale; see Locale.

  • Currency no symbol does the same as Currency, but omits the currency symbol.

  • Leading zero adds a leading zero to a floating value between 0 and 1. This format is only available for fields that contain a float value. Note that when you open a data file or database without a data mapping configuration, all fields are of the type string.

  • ∑ (Sum) and ∑↑ (Sum Up) are used in Detail Tables in a Print context. is for transport rules at the end of a page and ∑↑ shows the subtotal of the previous page.