5 Replies Latest reply on Jun 1, 2011 6:55 AM by LucaFranzin

    FM9 Print set up script

    TonyS

      Title

      FM9 Print set up script

      Post

      Hi

       

      Anyone know how to get Filemaker9 to print the number of copies by field value?

       

      Tony

        • 1. Re: FM9 Print set up script
          TSGal

          Tony:

           

          There is no direct way with FileMaker Pro 9 to print the number of copies by a field value.

           

          Here are two scenarios/workarounds that may help.

           

          Scenario 1:

          Create a script that uses the "Print" command.  Under "Specify print options", enter "1" for number of copies.  Duplicate this script, name it "2 copies", edit the "Specify print options", and enter "2" for number of copies.  Repeat this step "n" times for the maximum number of copies.  Then, when you want to print, you can evaluate the field and decide which script to call.  For example,

           

          If [field value = 1]

             Perform Script ["1 copy"]

          Else

             If [field value = 2]

                Perform Script ["2 copies"]

             Else

          ....

           

                 If [field value = <n>]

                    Perform Script ["n copies"]

                 End If

          ...

          End If

           

           

          ---------------------

           

          Scenario 2:

          Create a looping script.  That is, you can store the field value to a variable.  Each time you print (one copy), the variable is decreased by one.  Repeat until the variable reaches zero.  For example:

           

          Set Variable [$val; Value: <field name> ]

          Loop

             Print [no dialog]

             Set Variable [$val; Value: $val - 1]

             Exit Loop If [$var = 0]

          End Loop

           

          ------------------

           

          The difference between both scenarios is that Scenario 1 sends one print job with the correct number of copies.  Scenario 2 sends "n" print jobs.

           

          Let me know if you need clarification for any of the above steps.

           

          TSGal

          FileMaker, Inc. 

           

           

          • 2. Re: FM9 Print set up script
            TonyS
              

            Thanks for that method 2 will be best as the qty could be up to 1000

             

            Thanks again

            Tony

            • 3. Re: FM9 Print set up script
              davidhead
                

              Given that print quantities can be very large, I would suggest that sending 1000 separate print jobs could be very slow. It might be better to slice it up into print jobs like this:

               

              Set Variable [$val; Value: <field name> ]

              Loop

                 If [$val ≥ 1024] 

                   Print [Restore]    // restores print current record and 1024 copies 

                   Set Variable [$val; Value: $val - 1024]

                 EndIf 

                 If [$val ≥ 512] 

                   Print [Restore]    // restores print current record and 512 copies 

                   Set Variable [$val; Value: $val - 512]

                 EndIf 

                 If [$val ≥ 256] 

                   Print [Restore]    // restores print current record and 256 copies 

                   Set Variable [$val; Value: $val - 256]

                 EndIf 

                 If [$val ≥ 128] 

                   Print [Restore]    // restores print current record and 128 copies 

                   Set Variable [$val; Value: $val - 128]

                 EndIf 

                 If [$val ≥ 64] 

                   Print [Restore]    // restores print current record and 64 copies 

                   Set Variable [$val; Value: $val - 64]

                 EndIf 

                 If [$val ≥ 32] 

                   Print [Restore]    // restores print current record and 32 copies 

                   Set Variable [$val; Value: $val - 32]

                 EndIf 

                 If [$val ≥ 16] 

                   Print [Restore]    // restores print current record and 16 copies 

                   Set Variable [$val; Value: $val - 16]

                 EndIf 

                 If [$val ≥ 8] 

                   Print [Restore]    // restores print current record and 8 copies 

                   Set Variable [$val; Value: $val - 8]

                 EndIf 

                 If [$val ≥ 4] 

                   Print [Restore]    // restores print current record and 4 copies 

                   Set Variable [$val; Value: $val - 4]

                 EndIf 

                 If [$val ≥ 2] 

                   Print [Restore]    // restores print current record and 2 copies 

                   Set Variable [$val; Value: $val - 2]

                 EndIf 

                 If [$val ≥ 1] 

                   Print [Restore]    // restores print current record and 1 copies 

                   Set Variable [$val; Value: $val - 1]

                 EndIf

                 Exit Loop If [$var ≤ 0]

              End Loop 

               

               

              With this script, 1000 copies would be sent as 11 print jobs. 

              Printing 900 copies would be four print jobs.

              • 4. Re: FM9 Print set up script
                TonyS
                  

                Thanks David, I'm spoilt for choice, I'll set it up

                 

                Thanks

                Tony

                • 5. Re: FM9 Print set up script
                  LucaFranzin

                  What about if I have a list of description field and quantity field and I would like to print number of copies as quantity field starting from the first record to the last having lists from 10 to 1000 records ?

                  Thank's in advance

                  Luca