9 Replies Latest reply on Feb 21, 2014 8:22 AM by philmodjunk

    Printing address labels

    margagb

      Title

      Printing address labels

      Post

           Hello,

           I'd like to know if it is possible to print one address from one record multiple times on one sheet of labels. I have 4 large labels per sheet of paper (A4).  I want to print address labels for boxes to be shipped (boxes from one order with just one address). Example: I have 4 boxes and I need 4 address labels. What I do now is I select 4 copies in my print settings. This results in 4 sheets with just one address label used (the top one). How can I print the same shipping address on all the labels on that one sheet? 

           Any suggestions? 

           Thanks.

        • 1. Re: Printing address labels
          philmodjunk

               Base your labels layout on a different table, Labels and link it like this to your current table:

               MainTable::__pkMainTableID = Labels::_fkMainTableID

               A script can then copy the value of MainTable's primary key (__pkMainTableID in my example) to a variable, then it can change layouts and use a loop to create a set of records in Lables, setting _FkMainTableID to the value of the variable. You can then include address fields from MainTable on your Labels layout and you can create as many records and print as many layouts as needed. You can enter a value in a number field in MainTable to specify the number of labels that you want. The loop can compare the number of labels created to that value to determine when to exit the loop.

          • 2. Re: Printing address labels
            margagb

                 Thanks Phil, I created a script and it works. I started the script with a custom dialog asking how many labels they want to print… and continued with the variables and loop...

                 Tried to copy the script in this message but it won't let me...

                 BTW… Before I received your reply I had checked the Knowledge Base for answers but their suggestions (3 methods) weren't great.

                   

            • 3. Re: Printing address labels
              philmodjunk

                   and you haven't indicated what happened when you ran your script. From context, it didn't work for you or you wouldn't want to post your script, but you haven't said HOW it didn't work and that can be a helpful clue.

                   To post a script to the forum:

                     
              1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
              2.      
              3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
              4.      
              5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
              • 4. Re: Printing address labels
                margagb

                     Maybe I did not communicate properly, but the script does work. I now can print the same address multiple times on one sheet of labels…. I still need to add a script to delete the records from the LABELPRINT table and do some further testing...

                     Reason why I wanted to post the script  to the forum as it may be helpful to others… Anyway, here is the script.

                                    Show Custom Dialog [ Title: "QtyLabels"; Message: "Hoeveel adresetiketten wil je printen?"; Default Button: “OK”, Commit: “Yes”;

                                    Button 2: “Cancel”, Commit: “No”; Input #1: delivery_order_ADDRESS_shipping::QtyLabels, "Aantal labels" ]

                If [ Get ( LastMessageChoice ) = 1 ]

                Set Variable [ $ID; Value:delivery_order_ADDRESS_shipping::__kp_AddressID ]


                Set Variable [ $Qty; Value:delivery_order_ADDRESS_shipping::QtyLabels ]

                                    
Go to Layout [ “LabelPrint Delivery” (delivery_order_address_shipping_LABELPRINT) ]

                Set Variable [ $I; Value:0 ]

                                    
Loop

                Set Variable [ $I; Value:$I + 1 ]


                Exit Loop If [ $I > $Qty ]

                                    
New Record/Request


                Set Field [ delivery_order_address_shipping_LABELPRINT::_kf_AddressID; $ID ]

                End Loop

                Go to Layout [ original layout ]

                End If

                Set Error Capture [ On ]

                                    
Print Setup [ Orientation: Portrait; Paper size: 8,26" x 11,69" ]

                                    [ Restore; No dialog ]

                Go to Related Record [ From table: “delivery_order_address_shipping_LABELPRINT”; Using layout: “LabelPrint Delivery” (delivery_order_address_shipping_LABELPRINT) ]
[ Show only related records; New window ]

                If[Get(LastError) ≠0]

                Halt Script

                End If

                
If [ Get ( SystemPlatform ) > 2 ]

                Freeze Window

                
Print Setup [ Orientation: Portrait; Paper size: 8,26" x 11,69" ]

                                    [ Restore ]

                Print [ Current record; Pages: 1 to 1; Orientation: Landscape; Paper size: 8,26" x 11,69" ] [ Restore: Brother DCP-150C ]

                Close Window [ Current Window ]

                Else

                Enter Preview Mode

                End If

                      

                • 5. Re: Printing address labels
                  philmodjunk

                       Given the special needs of label printing, I prefer to enter preview mode and pause on the labels layout after setting up the records instead of just printing the labels. That allows the user to see what they are going to get and gives them time to insert a labels page into the printer if they forgot to do so.

                       You can include a Delete All Records step just before you close the window to delete the records after you have printed them.

                  • 6. Re: Printing address labels
                    margagb

                         Phil,

                         Thanks for your suggestion. I think my script is not totally correct, as it enters preview mode and shows the labels before printing.. It does not automatically print. Apart from that I can't get the delete all records to work in the step just before close window. So I am assuming the print script is not totally correct. However, I do not have FileMaker Pro Advanced, and therefore no debugger… so it is hard for me to see what step(s) is (are) not working. I resolved the issue for now by creating a separate simple script to delete all records. 

                    • 7. Re: Printing address labels
                      philmodjunk

                           I misread your script. What is the purpose of using get ( SystemPlatform ) in an If step? What problem does that solve for you?

                           And your script uses GTRR to open  a new window but that window is not closed unless Get ( SystemPlatform ) returns a value less than or equal to 2.

                           You'll need to set up your script to delete all records no matter how your If step evaluates, but there seems to be some steps missing for the path that previews your labels.

                      • 8. Re: Printing address labels
                        margagb

                             I copy and pasted the print script from another script… and as it worked OK I just left it the way it was…  I guess I need to go through it carefully step by step… but as I don't have Advanced it will take some time… and apart from that I am not that great in writing scripts! But I'll get there eventually… but I am quitting for now… it's Friday evening here… and the weekend is about to start. 

                        • 9. Re: Printing address labels
                          philmodjunk

                               Then I would remove that If block--which checks to see if you are using a Mac or windows computer (value returned is < 2) or an iOS device or is a webDirect user using an web browser to access your database (value returned is 2 or larger.)

                               End your script like this:

                               Enter Preview Mode [pause]
                               Delete All Records [no dialog]
                               Go to Layout [Original layout]

                               The script will produce the needed records for labels, preview them and then pause. The user can then select a printer, change print setup settings if needed and then select print from the File Menu. This should be familiar to your users as this is how they would print from nearly any other application. The only wrinkle is that you need to remind them to select the "records being browsed" option when they print.

                               If you don't want them to make those selections, use these script steps:

                               Enter Preview Mode [pause]
                               Print [Restore]
                               Delete All Records [no dialog]
                               Go to Layout [Original layout]