You are here: Designer > Features > Personalizing Content > Loading data
 

Loading data

Before you can add variable data fields to a template in the Designer, you need to have a Data Model and a sample of customer data. At the design stage the Designer doesn't have to have access to all data; it just needs to know which data fields exist in your data and it needs some data to be able to display a preview of the output.

To get access to a Data Model and data, you can open:

After opening a data file or database, the Data Model pane at the right hand bottom shows the data fields that occur in the data.
The Value column displays data from the first record in the data file. Use the First, Previous, Next and Last buttons to browse through the records.

If you have no data at hand, download a demo from https://demo.objectiflune.com and open a dummy data file to test with.

Adding data from a data file

  1. Click File, select Add Data and then click From file data source. Browse to the location of the file and select it.
    The Designer can open the following types of data files:
    • CSV files (.csv)
    • Microsoft Access Database (.mdb, .accddb)
    • XML files (.XML).
    • AFP files (optional).
  2. Review the options presented, to ensure that the data will be interpreted correctly. The options available depend on the type of data file (see below).

CSV file options

  • Encoding: the Designer can not infer from a CSV file what encoding it is in. The default is right in the large majority of cases, but when it isn't, it can be very difficult to figure out the correct encoding. Ask your source what the encoding of the file is.
  • Field separator: choose the character that separates the fields in the file.
  • Comment delimiter: if there are comment lines in the file, type the character that starts a comment line.
  • Text Delimiter: type the character that surrounds text fields in the file. Other delimiters will not be interpreted within these text delimiters.
  • Ignore unparsable lines: when checked, any line that does not correspond to the above settings will be ignored.
  • First row contains field names: check this option to use the first line of the CSV as headers. This option automatically names all extracted fields.

MDB file options

  • File: Include the full path to the file.
  • Password: If the file isn't password protected, you can click Next without filling out this field.
  • Table name: Use the drop-down to select the appropriate table or stored query to retrieve the appropriate data set.
  • Encoding: Use the drop-down to select the encoding with which to read the data in the table.

XML File options

Select what level of XML elements defines a record.

The Trigger is what triggers the creation of a new record. It can be set to:

  • On element: this defines a new record when a new element occurs on the selected XML level.
  • On change: this defines a new record when a specific field under the chosen XML level has a new value. After selecting this option, you have to select the field that triggers the creation of a new record.

Adding data from a database

  1. Click File, select Add Data and then click From database data source. Browse to the location of the file and select it.
    The Designer can open databases from the following types of data sources:
    • MySQL
    • Microsoft Access Database (.mdb, .accddb)
    • SQL Server
    • ODBC DataSource
    • JDBC
    • Oracle.
  2. Review the options presented. The options available depend on the type of database data source; see below.

MySQL

  1. Enter the appropriate information to connect to the database:
    • Server: Enter the server address for the MySQL database.
    • Port: Enter the port to communicate with the MySQL server. The default port is 3306.
    • Database name: Enter the exact name of the database from where the data should be extracted.
    • User name: Enter a user name that has access to the MySQL server and specified database. The user only requires Read access to the database.
    • Password: Enter the password that matches the username above.
  2. Click Next and enter the information for the source table.
    • Connection string: Displays the full path to the database.
    • Table: Use the drop-down to select the appropriate table or stored query to retrieve the appropriate data set.
    • Encoding: Use the drop-down to select the encoding with which to read the data in the table.
  3. Click Finish to open the database.

Microsoft Access

  1. Enter the appropriate information to connect to the database:
    • File name: Browse to your Microsoft Access database file (.mdb)
    • Password: Enter a password if one is required.
  2. Click Next and enter the information for the source table.
    • Connection string: Displays the full path to the database.
    • Table: Use the drop-down to select the appropriate table or stored query to retrieve the appropriate data set.
    • Encoding: Use the drop-down to select the encoding with which to read the data in the table.
  3. Click Finish to open the database.

SQL Server

  1. Enter the appropriate information to connect to the database:
    • Server: Enter the server address for the SQLServer database.
    • Port: Enter the port to communicate with the SQLServer. The default port is 1433.
    • Database name: Enter the exact name of the database from where the data should be extracted.
    • User name: Enter a username that has access to the SQLServer and specified database. The user only requires Read access to the database.
    • Password: Enter the password that matches the username above.
  2. Click Next and enter the information for the source table.
    • Connection string: Displays the full path to the database.
    • Table: Use the drop-down to select the appropriate table or stored query to retrieve the appropriate data set.
    • Encoding: Use the drop-down to select the encoding with which to read the data in the table.
  3. Click Finish to open the database.

ODBC DataSource

  1. Select the ODBC system data source. Note: Only 32-bit data sources are currently shown in this dialog, even if your system is 64-bits.
  2. Click Next and enter the information for the source table.
    • Connection string: Displays the full path to the database.
    • Table: Use the drop-down to select the appropriate table or stored query to retrieve the appropriate data set.
    • Encoding: Use the drop-down to select the encoding with which to read the data in the table.
  3. Click Finish to open the database

JDBC

  1. Enter the appropriate information to connect to the database:
    • JDBC Driver: Use the drop-down to select which JDBC Driver to use for the database connection.
    • JAR file path: Enter a path to the JAR file that contains the appropriate driver for the database below.
    • Server: Enter the server address for the database server.
    • Port: Enter the port to communicate with the server.
    • Database name: Enter the exact name of the database from where the data should be extracted.
    • User name: Enter a username that has access to the server and specified database. The user only requires Read access to the database.
    • Password: Enter the password that matches the username above.
    • Advanced mode: check to enable the Connection String to manually enter the database connection string.
    • Connection string: Type or copy in your connection string.
  2. Click Next and enter the information for the source table.
    • Connection string: Displays the full path to the database.
    • Table: Use the drop-down to select the appropriate table or stored query to retrieve the appropriate data set.
    • Encoding: Use the drop-down to select the encoding with which to read the data in the table.
  3. Click Finish to open the database.

Oracle

  1. Enter the appropriate information to connect to the database:
    • Server: Enter the server address for the Oracle database.
    • Port: Enter the port to communicate with the Oracle server.
    • Database name: Enter the exact name of the database from where the data should be extracted.
    • User name: Enter a username that has access to the Oracle server and specified database. The user only requires Read access to the database.
    • Password: Enter the password that matches the username above.
  2. Click Next and enter the information for the source table.
    • Connection string: Displays the full path to the database.
    • Table: Use the drop-down to select the appropriate table or stored query to retrieve the appropriate data set.
    • Encoding: Use the drop-down to select the encoding with which to read the data in the table.
  3. Click Finish to open the database.

After adding data from a database, the Data Model pane at the right hand bottom shows the data fields that occur in the data.

The Value column displays data from the first record in the data file. Use the First, Previous, Next and Last buttons to browse through the records.

Add a counter using the Generate Counter Wizard

Generating a counter is useful for numbered tickets or any other template requiring sequential numbers but no variable data.

The Generate Counter Wizard creates a record set with a Counter field and in that field, the current counter value for each record. The Counter starts and stops at set values and is incremented by a set value as well.

  1. To open the Generate Counter Wizard, select File > Add data > Generate counters.
  2. Adjust the settings:
    • Starting value: The starting number for the counter. Defaults to 1.
    • Increment value: The value by which to increment the counter for each record. For example, an increment value of 3 and starting value of 1 would give the counter values of 1, 4, 7, 10, [...]
    • Number of records: The total number of counter records to generate. This is not the end value but rather the total number of actual records to generate.
    • Padding character: Which character to add if the counter's value is smaller than the width.
    • Width: The number of digits the counter will have (prefix and suffix not included). If the width is larger than the current counter value, the padding character will be used on the left of the counter value, until the width is equal to the set value. For example for a counter value of "15", a width of "4" and padding character of "0", the value will become "0015".
    • Prefix: String to add before the counter, for example, adding # to get #00001. The prefix length is not counted in the width.
    • Suffix: String to add after the counter. The suffix length is not counted in the width.
  3. Click Finish to generate the Counter record set.
While the Generate Counter script is really useful for things like raffle tickets, it's unusable in combination with a data file or database, as it cannot complement that data automatically. This can only be done with a script. A script that adds a counter to data, using the current record index to calculate the current counter value, can be found in this how-to: Manual counter in designer.