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 printed item. Consider the following example:

A retail company prints shipping labels, and the "Ship To" address that is 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 database 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"

Note that empty fields are indicated by two quotation marks "".

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

If you set up your template to have each of these fields print out as separate text objects, your labels would be printed 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 the blank second field in the second record, and the blank first field in the third record. You can avoid these skipped lines by specifying that BarTender suppress a carriage return whenever the previous data source is empty.

Using this method, the same three labels would be printed 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 a BarTender document for this scenario, follow these steps:

  1. Create the database.

  2. Open BarTender and create a new blank document.

  3. Connect to the database.

  4. Create the address label text object.

  5. Configure the address label text object.

  6. Suppress the blank fields.

See the detailed procedures below.

ClosedTo create the database

  1. Copy the sample database, above, into a text file.

  2. Separate each line with a carriage return.

  3. Save the file as SuppressionExample.txt.

ClosedTo connect to a database

  1. From the BarTender File menu, select Database Connection Setup to open the Database Setup Wizard.

  2. In the Database Setup Wizard, select Text File.

  3. Click Next.

  4. Click Select File.

  5. Navigate to SuppressionExample.txt, and then click Open.

  6. Click Next.

  7. From the Field Separation dropdown list, select Quote and Comma.

  8. Click Next.

  9. Select The first row is a header containing field names.

  10. Click Finish.

  11. Click OK.

ClosedTo create the 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. By default, multi-line text objects are defined as paragraphs in the Text Format property page.

  3. Click on the template to place the text object.

ClosedTo configure the address

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

  2. In the Navigation Pane, select the desired data source.

  3. At the bottom of the Navigation Pane, click to open the New Data Source Wizard.

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

  5. For Field, select the desired database field. (CustomerName should be the first field in this example).

  6. In the Sample Data field, enter some text describing the database field. For example, you might enter "Customer Name" or a generic example such as "Jane Doe" for the field CustomerName.

  7. Click Finish to close the wizard.

  8. Click to open the New Data Source Wizard.

  9. Select Embedded Data as the data source type.

  10. Click Finish to close the wizard.

  11. In the Navigation Pane, select the data source that you just created.

  12. In the Embedded Data field, highlight the sample text, and then press Enter to insert a carriage return.

  13. Repeat steps 3 through 7 for each line of the address:

    • "CompanyName"

    • "StreetAddress"

    • "City"

    • "State"

    • "ZIP"

  14. In the left Navigation Pane, select the embedded data source that has the carriage return, and then click at the bottom of the pane to copy it. Alternatively, right-click to select Copy from the selected data source's context menu.

  15. Select the CustomerName database field, and then click to paste a carriage return after the field. Alternatively, right-click to select Paste from the database field's context menu.

  16. Paste a carriage return after CompanyName and StreetAddress.

  17. After City, insert an embedded data source that consists of a single comma followed by a space.

  18. After State, insert an embedded data source that consists of only a space.

  19. When you have finished, close the Properties dialog.

From the File menu, select Print Preview. When you page through the records, you will see missing lines in the second and third records.

ClosedTo suppress blank fields

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

  2. In the left Navigation Pane, select the first embedded data source that contains a carriage return.

  3. Select the Transforms tab.

  4. Click at the right of 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.

From the File menu, select Print Preview. When you page through the records, the blank lines in the second and third records will be gone.

Related Topics