Using data-driven content with Pageflex


Before you begin...

This article should be used in conjunction with the conventions laid out in the Creating user input fields for Pageflex . A healthy understanding of the Liftoff XML descriptor file should be used as a prerequisite to reading this article.


Liftoff employs a powerful, yet simple approach to integrating native and external data sources into the web to print workflow. These features allow you to integrate textual data, lists and images with your design templates and form presentation.

There are two types of data you can merge with your templates:

Native System Variables
A native system variable is data that is readily present and available using variable injection commands. The most common and present source is customer profile information. For example, if you wanted to inject a logged in customer's name into a template, you can simply nest the command @[email protected] in the inner text of the variable XML element. Example:
<variable order="1" name="ContactName" attributes="" maxLen="50" type="text" caption="Name">@[email protected]</variable>.

Data Driven Values
Liftoff incorporates a powerful "database in the cloud" solution we call Records. This robust feature gives you the ability to create customizable data tables for many purposes including asset management, list management, contact management, blogs, news feeds, and best of all - the ability to integrate live data into your web to print forms and templates.

Working with native system variables

As described in the overview, you can incorporate customer profile data into your templates using a few very simple commands. The current supported native entity is the Customer object. These are accessible by implementing an open and closing @ symbol with the Customer.<Field> convention nested between them. Below are the acceptable variables available for the Customer object:

@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]
@[email protected]

In addition to the Customer. options, we also support the ability for SKU Options. The syntax for that is @[email protected] For example, let’s consider that there is an apparel item with multiple variants. The item is available in 3 colors. Your client’s selection of color will determine what image is displayed when configuring your product, without selecting the color during the configuration process.

<variable order=”1” name=”color” attributes=”” maxLen=”50” type=”invisible” caption=””>@[email protected]</variable>

You would just need to make sure your PF document included a rule regarding the color selection.


Example of Pageflex rule related to SKU Option

Custom Customer Fields
The convention for using custom customer fields is very similar to the notations above. If you have a custom customer field named “Company Name”, you would notate this as:
@[email protected]
The convention calls for the prefix of Custom_ appended to the variable name. Spaces are not allowed in variable names, thus if you have spaces in your field name, they should be omitted from your variable name.

Example: The field Company Name translates to a variable name of Custom_CompanyName.
Please note that some custom customer field types should not be used to populate templates. For more information on customer field types, see Custom Customer Fields and Custom Registration.

  • Checkbox – This field type will return a value of 1 or 0.
  • File – This field type will not populate any information.
  • Image – This field type will not populate any information.
  • Linked Record – This field type will populate the record ID number.
  • Select – This field type will output a pipe-delimited list of values.

Example XML document using native system variables

<?xml version="1.0" encoding="UTF-8"?>
  <group page="1" order="3" name="Imprint Information">
   <variable order="1" name="Name" attributes="" maxLen="50" type="text" caption="Name">@[email protected]</variable>   
   <variable order="2" name="Title" attributes="" maxLen="50" type="text" caption="Title">@[email protected]</variable>
   <variable order="2" name="Address" attributes="" maxLen="50" type="text" caption="Address">@[email protected]</variable>
   <variable order="6" name="CityStatezip" attributes="" maxLen="50" type="text" caption="City, State Zip">@[email protected], @[email protected]  @[email protected]</variable>
   <variable order="7" name="Email" attributes="" maxLen="50" type="text" caption="Email">@[email protected]</variable>

Implementing data-driven records

Before you can begin using data-driven data in your templates. You must have first established a table using the Content->Records feature. For the examples in this section, we're going to assume that we have a table called Contacts that have the following fields Name, Address, CityStateZip and Email.

Creating a drop down list
To implement a drop down list, we're going to use the object type recordselect as a new variable:

<variable order="1" name="Name" attributes="recordType:Contacts,displayField:Name" type="recordselect" caption="Name"></variable>

In the attributes section, the value recordType:Contacts, indicates that we're pulling data from the Contacts table. displayField:Name states that we want to use the field Name as the display value for our selector.

If implemented properly, you should see a drop down box that pulls from the designated table using the field you indicated for the display value.

Sorting records in a record variable for checkboxlist
Record variables present you a way to sort the returned values based on an existing record field. You may also specify sort direction, including random sorting. Below is an example of sorting the contacts list by the Name field:

<variable order="1" name="Name" attributes="recordType:Contacts,displayField:Name,sortFieldCode:Name,sortOrder:desc" type="checkboxlist" caption="Name"></variable>

The sortFieldCode attribute tells the parser which field you're choosing as the sort by field. sortOrder designates the direction. The following values are applicable for sort order:

asc for ascending sort direction
desc for descending sort direction
rand for random sorting

Using selected data to populate other fields
There may be cases where you desire to have a customer's selection to drive the values that appear in subsequent fields on your form. Mapping fields to a drop down box is relatively easy.

For this example, we want the change of a selection to the Name box to pre-populate the address fields on the form. This function works for both the text and static control types.

To implement the pre-fill, modify your text or static control's attributes to contain a comma-separated value of recordselectVariable and recordField such as recordselectVariable:var_Name,recordField:Address.

recordselectVariable refers to the control you're binding the result set to. In this case, we're binding to Name. When declaring this binding, ensure you're prefixing the control name you're binding to with _var.

Example populating address:
<variable order="1" name="Address" attributes="recordselectVariable:var_Name,recordField:Address" required="Address is required." maxLen="50" type="text" caption="Address *"></variable>

Example populating city, state and zip:
<variable order="1" name="Address" attributes="recordselectVariable:var_Name,recordField:CityStateZip" required="City State Zip is required." maxLen="50" type="text" caption="City, State and Zip*"></variable>


Variable Names

Variable names are case sensitive. If your form does not work, please ensure they're typed exactly as defined in your records table.

XML example using record selection

<?xml version="1.0" encoding="UTF-8"?>
<group page="1" order="3" name="Custom Information">
<variable order="1" name="Name" attributes="recordType:Stores,displayField:Name,sortFieldCode:Name,sortOrder:desc" type="recordselect" caption="Location"></variable>
<variable order="2" name="EmpName" attributes="" required="Name is required." maxLen="50" type="text" caption="Name *"></variable>
<variable order="2" name="Title" attributes="" required="Title is required." maxLen="50" type="text" caption="Title *"></variable>
<variable order="1" name="Address1" attributes="recordselectVariable:var_Name,recordField:Address1" required="Address is required." maxLen="50" type="text" caption="Address *"></variable>
<variable order="1" name="City" attributes="recordselectVariable:var_Name,recordField:City" required="City is required." maxLen="50" type="text" caption="City *"></variable>
<variable order="1" name="State" attributes="recordselectVariable:var_Name,recordField:State" required="State is required." maxLen="50" type="text" caption="State *"></variable>
<variable order="1" name="ZIP" attributes="recordselectVariable:var_Name,recordField:ZIP" required="ZIP is required." maxLen="50" type="text" caption="ZIP *"></variable>
<variable order="2" name="Phone" attributes="recordselectVariable:var_Name,recordField:Phone" maxLen="50" type="text" caption="Phone"></variable>
<variable order="2" name="Extension" attributes="" maxLen="4" type="text" caption="Extension"></variable>
<variable order="2" name="Cell" attributes="" maxLen="50" type="text" caption="Cell"></variable>
<variable order="2" name="Fax" attributes="" maxLen="50" type="text" caption="Fax"></variable>
<variable order="2" name="Email" attributes="" required="Email is required." maxLen="50" type="text" caption="Email *"></variable>