Using Template Selectors

You can use template selectors in BarTender to conditionally print different templates based on the data that is read from a database or entered into a data entry form.

For example, suppose that you are printing membership cards for "gold" members, "silver" members, and "bronze" members. Instead of requiring you to load a different document for each membership type, BarTender can use a template selector to automatically select the preconfigured "gold," "silver," or "bronze" template to print, based on specified data conditions.

Template Selectors

A template selector is analogous to a folder that contains the templates that you use to conditionally print your items. You create a template selector for each conditional statement and then add templates to the template selector that capture the different data conditions that apply to that statement. When you run the print job, the specified data condition determines which template is printed.

In the example of the gold, silver, and bronze memberships, you want to print only one card for each person who applies for a membership, and you want the card template that is printed to vary depending on the membership type that the member purchases. To do this, you create three templates (one for each membership level) and then add them to the template selector. At print time, the template that is printed depends on the membership level that is selected by the print operator.

ClosedTo create and use a template selector

  1. Click on the main toolbar to open the Page Setup dialog. Alternatively, click Page Setup on the File menu, or double-click a blank area of the template.

  2. Click the Templates tab.

  3. Select the directory where you want to insert the new template selector. For templates that print only at the beginning or end of a print job, select Start of Job Template(s) or End of Job Template(s). All other template selectors should be added to the Primary Template(s) folder.

  4. Click on the template toolbar. Alternatively, right-click the template folder, and then click New Template Selector.

  5. In the Source for Template Name field in the Template Selector Properties area, specify the database field or data source value that contains the name of the template to print.

  6. Add templates to the newly created template selector by dragging an existing template into it or by selecting the template selector and then clicking on the toolbar to create a new template. For more information about how to create templates, refer to Inserting a New Template.

  7. Click OK to close the Page Setup dialog.

The data in the selected Source for Template Name field must exactly match the name of one of the templates. For example, suppose that the templates that are contained in the selected template selector are named "Gold Membership Card" and "Silver Membership Card". If the source is a database field, the information in the database must also be named "Gold Membership Card" or "Silver Membership Card".

If you want to prompt the print operator for the template name at print time, the data entry input must also exactly match the name of the template. Consider using a list box, dropdown list, or radio button list control on the data entry form to prevent data entry error at print time.