Database |
|||||||||||||||||||||||||||
Database is a very powerful tool for automation labels printing. To get connected to the database you must properly type the ADO connection string with all the necessary parameters. If you have difficulties with the string you may use the internal Windows tools. For this, click the "Select Data Source" button (see the picture below).
Database connection Tutorial
Lets suppose we have to link the simple database file to the label. We choose the CSV format as a database, it is a text format with the ";" fields separator symbol. Why CSV? Just because it is easy to operate and you don't have to install additional software, DMS, etc. Actually, the choice of formats is not limited and you may use various databases such as the DBF, Excel, MSSQL, Paradox, Interbase, Oracle, Access, etc. formats; this list may be limited only by the drivers installed on your computer.
This text file is a table with products we need to print.
Create a label to display these data (you can download it here).
Select a data source
Click the "Data source" button as shown in the picture below. Thus, we will set the same data source for all the selected objects.
Then the window where you will have to select "Database" and click the "Select Data Source" button will be displayed. You will see the window like the one below.
You should keep in mind that the picture in different Windows versions may vary but the main idea is the same.
You can use this database connection window in different ways depending on different conditions.
We will follow one of them. Lets use the connection string. For this, click the "Build..." button.
In the appeared "Select Data Source" window, go to the "Machine Data Source" tab and click the "New..." button.
Then select "Microsoft Text Driver (*.txt; *.csv)" in the driver list and click the "Next" button
In the data source parameters we will specify its name - "LABELDS" and the folder with the "items.txt" text file, in this case it is "С:\".
So we will get the string to get connected to the data source. Then you should write the SQL query to the data source. You can learn how to write SQL queries in special books or manuals on SQL. For example, to get all the database table records you should write the following query:
In our case the filename "items.txt" will be used as a table name. This done we will get the connection ready in full
You can check whether the connection works properly clicking the "Check connection" button. Press "Ok" if everything is right. Linking object properties to the table fields
After the data source for objects is set you should link the label objects to the corresponding data source field. For this, you should select the object and specify a field for it as shown below
Number of labels
We havent yet used the "Qty" field. This field contains the number of labels of each type to
be printed. In order to specify this number you should specify the same data source (the items.txt file)
for the label and link its "Number" property to the "Qty" field as before
You can view the result of the whole work in the preview (the menu option File - Print Preview)
and if you want you can print it. You can download the ready label (with the linked fields) here.
|