This is a reader-contributed article.
If you’re serious about music or DVDs, at some point you cross the threshold of having more than you can keep track of easily. The box full of index cards has served its purpose; it’s time to move on to storing information about your CDs and DVDs in a database.
This might seem like more of a pain than you can stand. What’s the point of doing a database when you can just type it all into a spreadsheet, for instance? Well, a spreadsheet is a good start but with a database you get a lot more features, including easily printing custom labels for all those legal backups you’ve made. You could also print out a record of all your movies or music, if you keep notes on them such as summaries, who you’ve loaned them to, and anything else you track.
Putting together a database and creating the forms to print what you want takes more than a couple steps, but it’s not that difficult. Even better, it’s free, since you can use the free open source office suite OpenOffice.org to do everything.
You can download and install OpenOffice.org from www.openoffice.org. Once you’ve got the program installed, you’ll complete these steps.
- Create a database. There are several ways to do this, but I’ll show you the quickest way.
- Create or download the document you want to print, from a source such as WorldLabel, and connect the document to the database.
If you’re a database god and enjoy spending time deep in a databaseâ€”well, you can do anything you want. If you want the most results for the least trouble, here’s what I recommend. Get your data in a spreadsheet, then create a database file that can read the spreadsheet. This is simple and if you don’t need advanced database features, it’s all you need.
This process creates an OpenOffice.org database file that points to your spreadsheet of information. The spreadsheet doesn’t have the power to do mail merges, but the database file pointing to it does. It acts as a middle man saying “The data’s over there, with these fields â€“ go get it.”
Getting Data Into a Spreadsheet
You either have your data in a spreadsheet already, or you can get it into a spreadsheet pretty easily. You’ll want to have it set up to look something like this, with field labels across the top, and with each piece of data separate.
Figure 1: Data setup
If your data is in .csv files, you can open those files in a spreadsheet.
1) In OpenOffice.org choose File → Open.
2) In the File Type list of the Open window, select Text CSV (click in that list and type T four times).
Figure 2: Selecting the Text CSV file format
3) Select the CSV file and click Open. In the window that appears, verify that the settings are correct for the data, then click OK.
Figure 3: Verifying the settings are correct for the data
4) Save the file as a spreadsheet, in spreadsheet format.
Figure 4: Saving the imported data in spreadsheet format
Creating the Database File That Points to the Spreadsheet
Now you’re ready to create the database file that reads the information out of your spreadsheet. It’s very simple.
1. Choose File → New → Database.
2. In the first window, select Existing Data Source, and Spreadsheet type. Click Next.
Figure 5: Specifying Spreadsheet as the database type
3. In the next window, point to the full path of the spreadsheet you want to use. Click Next.
Figure 6: Pointing to your spreadsheet
4. Leave all the checkboxes marked. You don’t need to edit the database but the first time, at least, it’s good to take a look at what the main database window looks like. Click Finish.
Figure 7: Finishing the database creation
5. Name the database. This name will show up when you do mail merges, and it’s the name and location you’ll look for when you want to do things with the database like create queries or reports. Click Save.
Figure 8: Naming and saving the database
6. You’ll see the database. Click the Tables icon at the left, and select a table name. Each sheet containing data in your spreadsheet will become a table. Now, on the right side, instead of None, select Document. You’ll see the data in the spreadsheet.
Figure 9: Viewing the new database and its table(s) in the database editing window
You don’t have to do anything elseâ€”you’re ready to pull information into your documents.
Updating the Data
When you have more data, just add it to the spreadsheet. When you want more tables, just add the data to another sheet in the spreadsheet.
Creating a Query to Restrict Data
Let’s say you might want to print labels for all the DVDs in your collection, or you might want to print labels only for DVDs released between 1998 and 2002. You’d need to create a query so that you could print labels based on that query, or on the whole database.
1. Open the .odb database file you created.
2. Click the Queries icon at the left side.
3. Click the option to use Design view.
Figure 10: Creating a query in Design view
4. In the window that appears, click Add to add the table you want to base the query on.
Figure 11: Selecting the table to base the query on
5. Double-click each field that you want to add to the query. Then add the limiting information in the Criterion field; an example is shown.
Figure 12: Creating the query
6. Click the Run Query icon, with the green checkmark, to see the results.
Figure 13: Running the query and seeing the results
7. Click the Save Query icon and name the query.
Figure 14: Saving and naming the query
8. Close the window.
Let’s say that you’ve created a lot of backups of your movies or you’re a musician with a burgeoning music career, or you’ve created a number of mix CDs. For whatever reason, you need to print out a lot of labels. The easiest way to do this is to create a mail merge that sucks the information out of your database and prints a label for each of your movies or CDs.
1. You need to print, so you need a document. You can download a CD template such as the 4.5" CD templates for Writer. The spacing is important so you’ll probably make more trouble for yourself than it’s worth by creating your own label template from scratch. I’ve shown the template here with the borders onâ€”it’s created as a tableâ€”so you can see what you’re working with more easily.
Figure 15: Template for CD or DVD case label with borders showing
2. To pull the data from your database, press F4 or choose View → Data Sources. Expand the database you want to use and select the table or query to use.
Figure 16: Selecting the query or table to do labels for
3. Click on the name of the field (not the data) that you want to use and drag it into the label. When you move your mouse over the field, you’ll see the full path of the database, table, and field. Drag in all the fields that you want to use.
Figure 17: Dragging in the fields to print on the labels
4. At this point, most of the choices are up to you. Add any other text, like labels for the title, actors, etc. You can put in graphics, do colorful formatting; anything you want. Use table formatting tools to align the text at the top or bottom, or just press Return a few times to get it where you want it. Add shading to the table or to the background of the document to get the color you want. Do everything in the first label to the second label, as well: the same formatting, etc.
Figure 18: Formatting the fields in the labels
5. Copy the fields from the first label to the second.
6. You now need to insert the trigger that will make the next record in the database printâ€”otherwise the next movie’s information won’t print until the next page.
a) In the second label area, click to the left of the first field, in this case Movie.
Figure 19: Preparing to insert an extra logic field
b) Choose Insert → Fields → Other, Database tab, select the Next Record field, select the database and table you’re using, and click Insert.
Figure 20: Inserting the field that will trigger the next record
c) The Next Record field will be inserted but it doesn’t take up any space, so it won’t be very obvious. You only need to insert the Next Record field once per record; not in front of each field.
Figure 21: The inserted Next Record field
d) If you have three or more label areas in the template, copy all the fields from the second label area to each additional area.
Now when you print, you’ll get a new record for each label.
7. Choose File → Print and click Yes to print a form letter. Don’t mark the checkbox; you want this window to appear each time.
Figure 22: Choosing to print a form letter, aka a mail merge
8. In the print window, choose to print to a printer and click OK.
Figure 23: Selecting the output for the mail merge
9. In the Print window, select the printer you want, and be sure it’s loaded with labels. Click OK.
10. One label will be printed for each movie (or other record) in your database.
Figure 24: The printed labels
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
|Category||List of Unix and Linux commands|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|