by Stewart Lynch, <slynch@richmond.sd38.bc.ca>, http://www2.sd38.bc.ca:8004/~slynch

Label Maker
As Easy as it Gets
BONUS: LABELMKR.FP3
PLATFORM: Mac/Win

Printing labels from FileMaker Pro has always been a bit of a challenge for the beginner. With considerations like multiple copies of only certain labels and what to do with the rest of a partially printed sheet of labels, label printing has always seemed to be only partially realized. That is until I saw Stewart Lynch's Label Printing Solution. Complete with the clearest interface that brings to mind that 'ole cliche, "a picture is worth a thousand words."

The Problem With Multiple Copies

If you have ever created a quick database to print return labels for yourself, you most likely approached it this way:

Create a label layout. Place your name and address as static text on the layout and duplicate the record for as many labels that appear on a single sheet of label stock. Makes good sense. It's fast and who cares that there are several blank records representing all of the labels on a sheet? After all, these types of quickies are throwaway files anyway. What to do if you need multiple copies of labels from records in your real production databases? The only way to get several labels for a record is to duplicate the record as many times as you need labels. Once you have created these redundant records for the purpose of printing, you need to then get rid of them when you're finished. This can get messy.

The Problem With Partially Used Label Sheets

I once had a client that carefully combined partially used sheets so as not to waste remainder label sheets. First of all, this is time consuming but more obviously, if you have ever had to deal with the wrath caused by an extremely sticky piece of paper in a laser printer, you would never consider such a method. The correct solution again is to create duplicate records for as many missing labels on the sheet, only this time, they need to be blank and appear at the beginning of the found set.

Duplication is the Answer

Simply leaning on the duplication key until you have enough of record one before moving onto record two is tedious and prone to error. Scripting will accomplish this for you with greater precision and convenience. In the bonus solution file "LABELMKR.FP3" notice that there is a number field "Quantity" that records the number of desired copies. Once the initial script tests for record totals greater than 0, the looping takes place, efficiently duplicating each record scheduled for printing. There is, however, a brilliant interface element that graphically represents on which label the printing will begin. Let's take a closer look at this aspect.

Click On The Starting Label Position

It will be the creation of blank records that bridges the missing labels and starts the actual printing on the first occurring label of the sheet. Not unlike entering a number of duplicates for the data containing records, the interface actually sets the "gStart" global number field to the number of missing labels. Because there are thirty labels on the desired label stock, there needs to be thirty scripts that each set the "gStart" field to the corresponding label position, Labels are numbered from top to bottom starting with the upper left location.

Once the location of the first label is recorded, the interface needs to update the graphical representation of the label sheet. This is accomplished with three global repeating container fields ten rows in length and two image source global container fields. After the number of missing labels is set by any one of the thirty "Set Start[#]" scripts, a subscript is called that evaluates the number for each row of the three repeating fields. For example, if you wanted the printing to start on the second label of the sheet, you would click on the second label image triggering a script that:

Set Field ["gStart","2"]
Perform Script [Sub-scripts, "Set Shading"]

which in turn would run a series of set fields for each row location:

Set Field ["gLbCol1","If(gStart > 1, gSHADED, gUNSHADED)"]
Set Field ["gLbCol1",-2"If(gStart > 2, gSHADED, gUNSHADED)"]
Set Field ["gLbCol1",-3"If(gStart > 3, gSHADED, gUNSHADED)"]

etc... all the way through 30.

The result is a clear graphical representation of where the printing will begin.

Another great thing about this solution is that the duplicates are in another printing utility database which nicely handles the duplicates without compromising the data structure of the primary file. The compromise I am referring to has to do with how FileMaker Pro handles record deletion. When a record is deleted, there is a small void in the file that isn't cleared out until a "Recovery" or "Save a copy as compressed" is performed. Because these types of duplication and delete solutions tend to grow the file size, it's beneficial that the database housing the data isn't compromised by the side effects of the continuing deletions.

Conclusion

I will certainly work this type of solution into my future label printing files. My first reaction to this interface was, "Why isn't this type of functionality built right into FileMaker Pro?" Perhaps if printer drivers ever settle down into consistent printable areas, we'll see features like this in the product... hint hint. But until then, I'll build it myself. The end result is well worth it.


## END ##