4 Replies Latest reply on Oct 5, 2012 9:48 AM by philmodjunk

    Define quantity of labels to print per record.



      Define quantity of labels to print per record.


           I print price labels from Filemaker for products in my store. Each product is a record in a database. I'd like to define how many labels I print for each record. Currently if I need 5 labels, I create 5 records of the product. Any ideas?



        • 1. Re: Define quantity of labels to print per record.

               If you are printing onto a sheet of labels instead of using a one label at a time printer (such as the Dymo), then you probably need to create the extra records, but you do not need to create the records in one of your existing tables, you can set up a "label printing" table with a relationship that links to the data you need to print on your labels. Then you generate the needed extra records in this table and leave your current tables unmodified.

          • 2. Re: Define quantity of labels to print per record.

                 Can a script create the necessary extra records, print and then delete the records?

            • 3. Re: Define quantity of labels to print per record.

                   Yes. That's exactly what I had in mind.

                   Say the information you want to print on your labels is all in a table named "Products". Say a field, __pkProductID in this table is an auto-entered serial number field that uniquely identifies each Product record...

                   Add a new field to your database: gNumbLabels. You can define it in any table in your database, but make sure that you specify global storage for it.

                   Define a new "labels" table with just one number field: _fkProductID and relate it to Products like this:

                   Products::__pkProductID = Labels::_fkProductID   (See this thread if this notation is unfamiliar to you: Common Forum Relationship and Field Notations Explained )

                   This script can then a) generate the needed labels, b) print them and c) delete them from the Labels table:

              #Before running this script, go to a Products Layout and perform a find for the Products records for which you want to print labels.
                   #Before running this script, enter the number of labels that you want to print into gNumbLabels.

                   Go To Record/Request/Page [First]
                   Go To Layout [Labels]
              #make sure you have an empty found set of Labels--very important to do this if you are hosting DB over a network
                   Enter Find Mode []--->clear the pause check box
                   Set Field [Labels::_fkProductID ; "-1" ] --> specify a value that won't match to any records
                   Set Error Capture [on]  --> keep "no records found" dialog from interrupting your script
                   Perform Find []
                   Set Error Capture [off]
              #Create the Labels Records
                   Go To Layout [original layout]
                      Set Variable [$ProdID ; Value: Products::__pkProductID]
                      Go To Layout [Labels]
                      Set Variable [$K ; value: 0 ]
                         New Record/Request
                         Set Field [Labels::_fkProductID ; $ProdID]
                         Set Variable [$K ; Value: $K + 1]
                         Exit Loop If [$K > Globals::gNumbLabels]
                      End Loop
                      Go To Layout [original Layout]
                      Go to Record/Request/Page [Next ; Exit after Last]
                   End Loop
              #Preview and Print the Labels
                   Go To Layout [Labels]
                   Enter Preview Mode [Pause]---> optional step, but allows you to confirm that labels are what you want and gives you time to load labels in printer
                   Print--> sometimes it's better to leave out this step and have users use Print from the File menu while script is paused.
              #Delete Labels Records
                   Delete All Records [No Dialog]
                   Go To Layout [original Layout]

              • 4. Re: Define quantity of labels to print per record.

                     Forgot a detail:

                     On your Labels layout, the relationship to products enables you to add any fields from Products that you want to include on the labels being printed. If you need to pull data from other tables, you can also link Labels to occurrences of those tables and use fields from them as well.