Suppression Example

When BarTender retrieves data from a database, it 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, and other records contain only the customer name or only the company name, as in the following sample database.

"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 these pieces of information are saved to a text file, each piece can be used as a database field. You can then create an address template that dynamically pulls the information from the database.

If you set up your template to have each of these fields be printed as separate text objects, your labels are 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 blank lines by specifying that BarTender suppress a carriage return whenever the previous data source is empty.

When you use this method, the same three labels are printed as follows, without the blank 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 then 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.

For more details, refer to the following procedures.

ClosedTo create the database

  1. Copy the sample database into a text file.

  2. Separate each line by using a carriage return.

  3. Save the file as SuppressionExample.txt.

ClosedTo connect to the database

  1. On the BarTender File menu, click Database Connection Setup to start the Database Setup wizard.

  2. In the Database Setup wizard, click Text File.

  3. Click Next.

  4. Click Select File.

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

  6. Click Next.

  7. In the Field Separation list, select Quote and Comma.

  8. Click Next.

  9. Click to select The first row is a header containing field names.

  10. Click Finish.

  11. Click OK.

ClosedTo create the text object

  1. On the object toolbar, click to add a text object. Alternatively, click Text on the Create menu.

  2. In the list of available text objects, select Normal Wrapped.

  3. Click the template at the location where you want to place the text object.

ClosedTo configure the address

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

  2. In the navigation pane, select the data source that you want.

  3. At the bottom of the navigation pane, click to start the New Data Source wizard.

  4. In the Type list, select Database Field, and then click Next.

  5. In the Field list, select the database field that you want. (In this example, CustomerName should be the first field.)

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

  7. Click Finish to exit the wizard.

  8. Click to start the New Data Source wizard.

  9. For the data source type, select Embedded Data.

  10. Click Finish to exit 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, as follows:

    • "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 the data source, and then click Copy.

  15. Select the CustomerName database field, and then click to paste a carriage return after the field. Alternatively, right-click the database field, and then click Paste.

  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. Close the Properties dialog.

On the File menu, click Print Preview. When you page through the records, you see blank fields in the second and third records.

ClosedTo suppress the blank fields

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

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

  3. Click the Transforms tab.

  4. Click at the right of Suppression to open the Suppression dialog.

  5. Click to select Suppress when previous data source is empty.

  6. Click OK to close the Suppression dialog.

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

  8. Click Close to close the Text Properties dialog.

On the File menu, click Print Preview. When you page through the records, you see that the blank fields in the second and third records are gone.

Related Topics