Suppression Example

When retrieving data from a database, BarTender may encounter fields that contain no data. In these cases, you may wish to suppress a data source so that a blank space will not appear on your label.

Consider the following example: a retail company prints a number of shipping labels where the "Ship To" address printed on the labels is retrieved from a central customer database. Some records contain a customer name and company, while others contain only the customer name or only the company name, as in the sample data below:

"CustomerName","CompanyName","Address","City","State","ZIP",
"Jake Diamond","Diamond, Inc.","PO Box 60","Gem Town","NV","50897",
"Meg Reilly","","148 Circle Drive","Maple","WA","98005",
"","All-State Trucking","5601 Interstate","Huntsville","IN","40890"

When saved into a text file, each of these pieces of information can be used as a database field, enabling you to create a generic address template that pulls the information in dynamically.

If you set up your template to have each of these fields print out as separate text objects, your labels would be outputted as follows:

Jake Diamond
Diamond, Inc.
PO Box 60
Gem Town, NV 50897

Meg Reilly
 
148 Circle Drive
Maple, WA 98005

 
All-State Trucking
5601 Interstate
Huntsville, IN 40890

Notice how the blank second field in the second record and the blank first field in the third record of the sample data file result in skipped lines on the labels. You can avoid these skipped lines by specifying that:

Using this method, the same three labels noted above would be outputted as follows, without the skipped lines:

Jake Diamond
Diamond, Inc.
PO Box 60
Gem Town, NV 50897

Meg Reilly
148 Circle Drive
Maple, WA 98005
 

All-State Trucking
5601 Interstate
Huntsville, IN 40890
 

To set up your document for this scenario, use the following procedure:

Connecting to a Database

  1. Save the information from the sample data above in a text file, with each item surrounded by quotation marks and separated by commas. Each line should be separated by a carriage return.

  2. In the Data Sources pane of the Toolbox, open the context menu for Database Fields.

  3. Select Database Connection Setup.

  4. In the Add Database Connection Wizard, select Text File.

  5. Click Next.

  6. Click Select File.

  7. In the Specify Text File dialog, navigate to the text file created in Step 1 and click Open.

  8. Click Next.

  9. Select Quote and Comma as the Delimitation Type.

  10. Click Next.

  11. Select Yes when asked "Is the first record of the text field a 'header' that contains the names of the fields?"

  12. Click Finish.

  13. Click OK.

Creating a Text Object

  1. Select from the object toolbar to add a text object. Alternatively, select Text from the Create menu.

  2. From the list of available text types, select Multi-line.

  3. On the template, click on the desired location for the text object.

Configuring the Address

  1. Double-click on the text object to open the Text Properties dialog. Alternatively, select Properties from the object's context menu.

  2. Click to open the New Data Source Wizard.

  3. For Type, select Database Field from the dropdown list and click Next.

  4. For Field, select the desired database field (i.e., CustomerName for the first field in this example).

  5. For Sample Field Data, enter some text resembling the database field. For example, you may enter "Jane Doe" for the field CustomerName.

  6. Click Finish to close the wizard.

  7. Again, click to open the New Data Source Wizard.

  8. This time, select Embedded Data as the data source type.

  9. Click Finish to close the wizard.

  10. In the Embedded Data field of the Data Source property page, highlight the text and press the <Enter> key to insert a carriage return.

  11. Repeat steps 2-5 for each line of the address, with Field and Sample Field Data inputs as follows:

  12. Copy the embedded data source with the carriage return, and paste it between the database fields for CustomerName, StreetAddress1, StreetAddress2, and City.

  13. Insert an embedded data source that consists of a ", " between City and State.

  14. Insert an embedded data source that consists of a " " between State and ZIP.

Suppressing blank fields

  1. Double-click on the text object to open the Text Properties dialog. Alternatively, select Properties from the object's context menu.

  2. Select the first embedded data source, containing a carriage return.

  3. Select the Transforms tab on the Data Source property page.

  4. Click next to Suppression to open the Suppression dialog.

  5. Select Suppress when previous data source is empty.

  6. Click OK to close the Suppression dialog.

  7. Repeat for each of the embedded data sources that contain a carriage return.

  8. Click Close to close the Text Properties dialog.

Viewing the Data

On the template, you should see the first entry from your database. On the View Navigator, select the Next button and notice that each of the blank lines in your database will no longer appear on your template.

Related Topics