Records Per Item Example

You can use the Records Per Item property page of the Database Setup dialog to print multiple database records on a single printed item and to specify how you want those records to be grouped on your printed items.

Consider the following example:

You have a text database that is called Products.txt. It contains thirteen records that consist of products and the region from which the product originated, as follows.

Product

Region

Knife
Dish Towel
Coffee Mug
Fork
Spoon
Tongs
Hot Pad
Dinner Glass
Wine Glass
Spatula
Tea Cup
Juice Glass
Tumbler

Western Region
Eastern Region
Southern Region
Western Region
Western Region
Western Region
Eastern Region
Southern Region
Southern Region
Eastern Region
Southern Region
Southern Region
Southern Region

You want BarTender to print a single item for each region that has all the products from that region printed on the item. The following procedures describe how to create the database connection, enable the printing of multiple records per printed item, and add the records to your template.

ClosedTo create the connection to the sample Products.txt database

  1. On the File menu, click Database Connection Setup. Alternatively, click on the main toolbar.

  2. In the Database Setup wizard, click Text File, and then click Next.

  3. Click Select File to browse to the Products.txt file.

  4. Click Products.txt, and then click Open. A file preview is displayed in the wizard.

  5. Click Next.

  6. On the File Format page of the wizard, you can click the Fields tab to see the data in a table format.

  7. Click Next.

  8. On the Field Names page of the wizard, verify that the first row is identified as field names for the data.

  9. Click Finish to complete the wizard. The Database Setup dialog opens.

ClosedTo enable the printing of multiple records per printed item

  1. In the Database Setup dialog, click Records Per Item.

  2. On the Records Per Item property page, for Maximum number of records per printed item, enter 6.

  3. In this example, 6 is an arbitrary number. Typically, you would set the maximum record limit to a number that would actually fit on the label or in the text object.

  4. Click to select the Break when field changes check box.

  5. In the Fields list, click to select the Region check box, and then click OK. This setting causes the returned records to break each time the value of the Region field changes.

  6. Click to select the Combine multiple records into single field check box.

  7. In the Fields list, click to select the Product check box, and then click OK. This setting enables the returned Product field values to appear in a single text object on the template.

  8. The Combine multiple records into single field feature supports only the text data type. Fields that use a different data type are not displayed in the Fields list.

  9. For the Separator option, click to select Custom, and then enter a comma followed by a space (, ). This setting specifies that the products that are listed in the text object are separated by a comma followed by a space.

  10. In the left navigation pane, click Sort Order.

  11. On the Sort Order property page, double-click Region to add it to the Fields to Sort By list. Alternatively, drag Region from the Available Fields list to the Fields to Sort By list. This operation causes the returned records to be sorted by the values of the Region field.

  12. Click OK to close the Database Setup dialog.

ClosedTo add the records to your template

  1. In the Data Sources pane of the Toolbox, expand the Database Fields node, and then drag Region to the template. A text object is created that uses the Region database field data source.

  2. In the Data Sources pane, locate Product [+] under Database Fields, and then drag Product [+] to a location on the template that is below the Region text object. A text object is created that uses the Product [+] database field data source.

  3. Use the arrows on the record navigation bar (at the bottom of the Template Design area) to view the items that will be printed for this document.

    You might see that the list of products on an item is too wide to fit on the template. When this happens, you can modify the text object so that the list of products wraps to multiple lines within the object.

    ClosedTo wrap the list of products within the text object

    1. Double-click the Products [+] text object to open the Text Properties dialog. Alternatively, right-click the object, and then click Properties.

    2. In the Text Properties dialog, click Text Format to open the Text Format property page.

    3. On the Wrap tab, click to select the Wrap to fit width check box.

    4. Click Close.

    5. Adjust the object width by dragging the object's horizontal sizing handle until the object is the width that you want.

In this example, when you print your document, the result is three items that resemble the following.

Southern Region

Coffee Mug, Dinner Glass, Wine Glass, Tea Cup, Juice Glass, Tumbler


Eastern Region

Dish Towel, Hot Pad, Spatula


Western Region

Knife, Fork, Spoon, Tongs

Three items are printed because there are three regions in the database and all the products for each region fit on one printed item. The maximum number of products per printed item is set to six, so if a region had exceeded six products, the additional products for that region would have been printed on a separate item. Similarly, if you were to add another region, an additional item would be printed.