Using multiple databases or tables (Video - 4:06)

 
Applies to: BarTender 2016
This video/article uses the following downloads:
download_icon.pngDatabase1.xlsx
download_icon.pngTable B.txt

Overview

Joins are basic functions of databases that enable you to merge the contents of two different tables and/or databases into a single view based on a common field or fields between them (that is, the join condition).

For more information on database joins please review the following:

About Table and Database Joins

Database Join Types

Join types

There are four join types available in BarTender: Inner, Left Outer, Right Outer, Full Outer

In BarTender, an inner join is the only join type supported when you are using data from multiple databases. In addition, full outer joins are not supported for Excel, Access, and MySQL databases.

 

Creating a join

Creating a database join in BarTender differs depending on whether the tables are from one database, or if the tables come from separate databases.  The examples below include sample database files to download and use while working through the exercise. 

Joining tables from the same database

Note: If you are using tables from different databases, then the steps are slightly different.  Please proceed to the example below Joining tables from separate databases.

This example will set up a join using two tables from the same Excel file.  Since they are tables from the same Excel file we can perform Inner, Left Outer, Right Outer joins, but not a Full Outer join.

  1. Place Database1.xlsx in C:\Database Join Test\
  2. Create a new BarTender document
  3. Click File > Database Connection Setup ..
  4. Select Excel and click Next
  5. Browse to C:\Database Join Test\ and select Database1.xlsx.  Click Next
  6. Add Table A and Table B to the Tables To Use list.  Click Next
  7. The wizard will automatically create a join condition.  Since both of the tables are from the same Excel file we can do an Inner, Left Outer or Right Outer join. Click Inner Join and change it to Left Outer Join
  8. Click Test and you should get a new record set
  9. Since this is a Left Outer join, and Donna exists in the "Left table", Donna is included in the new record set, however, since Donna doesn't have a value in the DepartmentID field, the DepartmentName field is blank for that record
  10. Close the Test record set.  Click Finish to complete the join
  11. Click OK to close Database Setup
  12. Save the label

 

Joining tables from separate databases

This example will set up a join using one table from an Excel file, and one from a CSV text file.  Since they are not tables from the same database, we can only set up an Inner join.

  1. Place Database1.xlsx and Table_B.txt in C:\Database Join Test\
  2. Create a new BarTender document
  3. Click File > Database Connection Setup ..
  4. Select Excel and click Next
  5. Browse to C:\Database Join Test\ and select Database1.xlsx.  Click Next
  6. Add Table A to the Tables To Use list.  Click Finish
  7. Click the   New Record Set icon in the lower left
  8. Select Text File and click Next
  9. Browse to C:\Database Join Test\ and select Table B.txt.  Click Next
  10. Set Encoding to Windows' System Default, and Field Separation to Comma.  Click Next
  11. Select The first row is a header containing field names.  Click Finish
  12. Click <Left Operand> and select Database 1.'Table A$'>DepartmentID
  13. Click <Right Operand> and select Table B.Table>DepartmentID
  14. Select Record Browser (Joined) to view the new record set
  15. Since it is an inner join, only records with a Department ID in both tables are included in the new record set
  16. Click OK to close Database Setup
  17. Save the label

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.