11 Replies Latest reply on Aug 22, 2011 1:58 PM by AmberSaundry

    Printing Multiple Labels?

    AmberSaundry

      Title

      Printing Multiple Labels?

      Post

      Hello,

      I am looking for help when printing labels. I have set up my layout to print labels, which it happily does.

      However, I am not looking for way to print duplicate copies of the same label. For example, I have Records A, B, & C. I want to print 1 label A, 2 labels of B, and 3 labels of C.

      The only way I have figured out how to do this so far is to duplicate the record for as many times as I need labels, so that I have 1 record of A, 2 records of B, and 3 records of C. I do not want to keep these duplicates in the database, so I need to go back to browse mode after and delete these copies.

      This can be time-consuming - is there any 'simple' way to have some kind of drop down box that lets you choose number of labels per record? And then when in preview mode, those records will print as desired, but there is still only 1 record in the actual dataset?

      Any guidance is appreciated.

      Thank you,
      Amber

        • 1. Re: Printing Multiple Labels?
          philmodjunk

          One way is to use a special "labels" table for printing labels. You can then create and destroy records in this table as needed without affecting your records in your existing table.

          Let's assume that you are printing mailing addresses and have a field named __pk_AddressID defined in your current table. This should be a serial number field so that it can uniquely identify each record in your current table of label data. If you need to know how to add such a field so that your existing records get a serial number, let me know.

          Define a new table, LabelPrint, with just one number field, _kf_AddressID,  to "match" to your table of addresses. In Manage | database | Relationshihps, you can set up a script like this:

          MailingAddresses::__pk_AddressID = LabelPrint::_fk_AddressID

          Now, a script like this can take the number in a Quantity field and make that number of LabeLPrint records:

          Set Variable [$ID ; value: MailingAddresses::__pk_AddressID ]
          Set variable [$Qty ; Value: MailingAddresses::Qty ]
          Go To layout [LabelPrint (LabelPrint)]
          Loop
            Set Variable [$I ; Value: $I + 1 ]
            Exit Loop If [$I > $Qty ]
            New Record/Request
            Set Field [LabelPrint::_fk_AddressID ; $ID]
          End Loop
          Go To Layout [original layout]

          To set up a layout for printing your labels create a labels layout based on LabelPrint, but add the needed address fields from the related MailingAddresses table.

          You can also use scripts to delete all records in this table prior to creating new ones or just after you finish printing them as a way to better manage what records exist in the LabelPrint table.

          • 2. Re: Printing Multiple Labels?
            AmberSaundry

            Hi PhilModJunk,

            Thank you so much for your prompt response and detailed instructions - I really appreciate your expertise!

            I need to keep my database flat-file, so that import of data is easy.  Can I write a script like this keeping the database flat-file?

            Thanks again,
            Amber

            • 3. Re: Printing Multiple Labels?
              philmodjunk

              I don't recommend that you do this. the presence of another table will have no effect on your ability to import data.

              • 4. Re: Printing Multiple Labels?
                AmberSaundry

                Hi PhilModJunk,

                Thanks again for your prompt and helpful responses – I’ve been tearing out my hair over this and this is great!

                I was concerned I would not be able to import data if I added this additional table, but as long as I still can then I am good to go with this method.  Here is what I have done.

                I had a table named ‘Vascular’, that included a catalogue of plant specimens I have collected.  Each specimen already has its own unique ‘Accession Number’.  So I created another table, named it LabelPrint, and created an ‘Accession Number’ field in this table:
                Vascular::Accession Number = LabelPrint::Accession Number

                The field in which I enter number of labels is called ‘LabelNumber’.  Here is the script I wrote:

                Set Variable [$ID; Value:Vascular::Accession Number]
                Set Variable [$LabelNumber; Value:Vascular::LabelNumber]
                Go to Layout [“LabelPrint” (LabelPrint)]
                Loop
                                Set Variable [$I; Value:$I + 1]
                                Exit Loop If [$I > $LabelNumber]
                                New Record/Request
                                Set Field [LabelPrint::Accession Number; $ID]
                End Loop
                Go to Layout [original layout]

                In LabelPrint, I created a label layout, mapping all fields back to Vascular (ie: <<Vascular::Accession Number>>). 

                I then went back to Vascular, selected the record for which I wanted to print labels, and selected the script through the Script menu.  It was a success – the designated number in LabelNumber appeared as copies in LabelPrint!  I could then go into Preview mode of LabelPrint and I was away to the races.  I then just went to Records, Delete all found records to clear out the LabelPrint table – is this okay?

                However, I found that if I had 10 records for which to print labels, I had to select each record in my found set (in the Vascular table), and perform the script to send it to LabelPrint.  Is there a way to send all records in a current found set in Vascular, to LabelPrint, with the appropriate amount of copies of each (as designated in the LabelNumber field)?

                 

                • 5. Re: Printing Multiple Labels?
                  philmodjunk

                  we can build on what you have by adding a loop that steps through your found set of records in the vascular table. I'm only adding the enclosing loop steps:

                  Go To Record/Request/Page [first]
                  Loop

                     Put your script here

                     Go to Layout [original layout] //you have this in your script, but it's crucial that this step goes here...
                     Go To record/Request/Page [next ; exit after last]
                  End Loop

                  And just deleting all records in LabelPrint is the simplest way to maintain that table. It's not the best option, however, if you have more than one person doing this at the same time as you could delete each other's label print records. If that's a possibility, you can have a script start with an empty found set (Do a find for all records with a negative ID number, for example) Then delete the found set after you finish printing. Each user has their own found set, so this approach keeps your users' actions separate from each other.

                  • 6. Re: Printing Multiple Labels?
                    AmberSaundry

                    Hi again PhilModJunk,

                    I’m so sorry, you will have to forgive my ignorance – scripting is very new to me and I don’t yet have a handle on it.

                    I thought I followed your instructions, but now only the first record in my found set is being sent to the LabelPrint table, no matter which record I currently have selected.  As mentioned, I’d like to bring up a found set, then be able to send this entire found set with each label’s appropriate number to the LabelPrint table.  Here is my script:

                    Go To Record/Request/Page [first]
                    Loop
                       Set Variable [$ID; Value:Vascular::Accession Number]
                       Set Variable [$LabelNumber; Value:Vascular::LabelNumber]
                       Go to Layout [“LabelPrint” (LabelPrint)]
                       Loop
                          Set Variable [$I; Value:$I + 1]
                          Exit Loop If [$I > $LabelNumber]
                          New Record/Request
                          Set Field [LabelPrint::Accession Number; $ID]
                       End Loop
                       Go to Layout [original layout]
                       Go To record/Request/Page [next ; exit after last]
                    End Loop

                    Did I place the Go To Layout incorrectly?  If you could please let me know what I am doing wrong, I’d really appreciate it.  Again, apologies, as this probably seems very n00b...

                    Thanks,
                    Amber

                    • 7. Re: Printing Multiple Labels?
                      AmberSaundry

                      Hi again (again) Phil,

                      I've been trying to figure this out to still no avail - any help you can provide is much appreciated!

                      I had one more question pop up - I realize I can either create a new table in 'Manage Database - Tables', in which case it the new table shows up in the Tables List and a new layout is created - or - I can create a new table in 'Manage Database - Relationships', in which case the new table does not show in the Tables list and a new layout is not created.

                      Are you able to explain why both these options are available, and for what purposes each method should be used?

                      I understand I am asking a lot, so no worries if not.  If you could just help me with the script to send all records in a found set to the LabelPrint layout, I'll be very happy!

                      Thanks again,
                      Amber

                      • 8. Re: Printing Multiple Labels?
                        philmodjunk

                        You've got things a bit "inside out" Wink

                        Go To Record/Request/Page [first]
                        Loop

                           Set Variable [$ID; Value:Vascular::Accession Number]
                           Set Variable [$LabelNumber; Value:Vascular::LabelNumber]
                           Go to Layout [“LabelPrint” (LabelPrint)]
                           Loop
                                        Set Variable [$I; Value:$I + 1]
                                        Exit Loop If [$I > $LabelNumber]
                                        New Record/Request
                                        Set Field [LabelPrint::Accession Number; $ID]
                           End Loop
                           Go to Layout [original layout]

                           Go To record/Request/Page [next ; exit after last]
                        End Loop

                        • 9. Re: Printing Multiple Labels?
                          AmberSaundry

                          Hi Phil,

                          I'm so sorry again - the code I wrote looks identical to the one you wrote, with the exception of some spacing?  Does this spacing affect it, and can I even insert spacing in ScriptMaker?

                          Am I missing something painfully obvious?  What is 'inside-out'?

                          Thanks again,
                          Amber

                          • 10. Re: Printing Multiple Labels?
                            philmodjunk

                            Apologies, I was in a hurry and misread your post. I though you had the inner loop as the outer loop.

                            I think I see the issue. The $I variable isn't being reset to 0 at the start of that loop:

                            Go To Record/Request/Page [first]
                            Loop

                               Set Variable [$ID; Value:Vascular::Accession Number]
                               Set Variable [$LabelNumber; Value:Vascular::LabelNumber]
                               Go to Layout [“LabelPrint” (LabelPrint)]
                               Set Variable [$I ; value: 0 ]
                               Loop
                                            Set Variable [$I; Value:$I + 1]
                                            Exit Loop If [$I > $LabelNumber]
                                            New Record/Request
                                            Set Field [LabelPrint::Accession Number; $ID]
                               End Loop
                               Go to Layout [original layout]

                               Go To record/Request/Page [next ; exit after last]
                            End Loop

                            2 of 2 people found this helpful
                            • 11. Re: Printing Multiple Labels?
                              AmberSaundry

                              BEAUTY!  It works!  Thank you soo much Phil - you will definitely be my favourite person of the week, maybe even month ;)

                              Eternal gratitude,
                              Amber