Personalizing content

Variable-data printing is a form of digital printing in which elements such as text and graphics may be changed using information from a database or data file. It prints unique documents with customized messages for each customer. This is exactly what you can do with OL Connect: using variable data you can personalize your company's communications (including but not limited to printed matter).

Before you can start personalizing the content of a template, you must open a data mapping configuration, Data Model, data file or database; see: Loading data.

Alternatively, you could create a Data Model, without extracting data, within the Designer; see Changing the Data Model.

The most common ways to personalize templates are listed below.

Variable data in the text

Variable data can be inserted in a template directly. For example, if a data field in your data holds a person's last name, the name of that data field can be put in the template, in an expression or a placeholder. When the template is merged with the data, the expression or placeholder gets replaced with a value, in this case, a person's last name.

Expressions look like this: {{FieldName}}. They get replaced with data from the current record by the Handlebars library which is integrated in OL Connect. The advantage of expressions is that fewer scripts and sometimes no scripts at all are needed in a template. See Variable data in text: expressions.

Placeholders require a script to replace them. See Variable data in text: scripts and placeholders.

Conditional content

In a template you may want to reveal content - text or images - to one group of recipients, but hide it from others. You can use a Conditional Script Wizard to achieve this, if you have a data field in your data on the basis of which a condition can be set. See Showing content conditionally.

Conditional Print sections

Entire Print sections can be included in or omitted from the output on the basis of one or more values in variable data. See Conditional Print sections.

Dynamic images and Print section backgrounds

Dynamic Images are dynamic in the sense that they are replaced by another image when a data field contains a certain value. Think of a signature image being swapped based on the sender's name, for example. You can use the Dynamic Image Script Wizard to make this happen; see Dynamic images.

To swap a Print section's background dynamically, you can use the Dynamic Background Script Wizard; see Dynamic Print section backgrounds.

Dynamic tables

A Dynamic Table is a table with a variable number of rows that can overflow on one or more pages. It can also display subtotals on transport lines. In invoices, a Dynamic Table is an essential element. Read Dynamic Table to learn how to insert a dynamic table.

Snippets

Snippets are pieces of content that can be re-used within the same template, in all contexts and sections. Snippets can contain any contents that a section can have, such as text, images, variable data, dynamic tables, etc. They are often very useful to personalize content, especially in combination with variable data and scripts. See Snippets and Loading a snippet via a script.

Handlebars snippets

Handlebars templates are a special kind of snippets in which you can use Handlebars expressions. The expressions get replaced with values when the snippet is merged with data. You determine - in a very small script - with which data the snippet will be merged. See Handlebars templates for instructions.

Handlebars is the name of a JavaScript library that implements a templating language (see https://handlebarsjs.com/). It uses a template and an input object to generate output. The Handlebars library is integrated in OL Connect Designer. See: Handlebars in OL Connect.

Scripts

As soon as you want to do more than what can be done with the available Script Wizards, self-made scripts are the solution. You could, for example, combine data of two or more data fields in a condition for conditional text. Or you could load a part of a snippet depending on the value of a data field. With a self-made script you can achieve anything that can be done by any of the Script Wizards, and much more.

The basics of script-writing in the Designer are explained in the following topic: Writing your own scripts.

Control Scripts

When output is generated from a template, Control Scripts run before all other scripts, when a record is merged with a context. They determine how different sections of the context are handled. They can, for example, make the page numbering continue over all Print sections, split Email attachments, or omit Print sections from the output.

Some functionality is provided as a Scripting Wizard, for example Conditional Print Sections.

See Control Scripts.

Post Pagination Scripts

Post Pagination Scripts are run in a Print context after the content has been paginated. Because they can search through the output of all Print sections, and modify Print sections (one at a time), they may be used to create a Table Of Contents (TOC), as explained in the topic: Creating a Table Of Contents.

See Post Pagination Scripts.