6 Replies Latest reply on Mar 2, 2009 8:38 AM by TSGal

    Printing script problem fm 10

    nealt

      Title

      Printing script problem fm 10

      Post

      The following script attempts to print out all records within a specific range. It doesn't do anything. Can someone help?

       

      Open File [ "Auction" ]

      Go to Layout ["Invoices" (Auction) ]
      View As [ View as Table ]
      Show Custom Dialog [Title: "Field Range"; Buttons: "OK", "Cancel"; Input #1: Auction::firstprint, "From Pattie #"; Input #2: Auction:· lastprint, "To pattie #" ]
      Set Field By Name [Auction:: Pattle number = Auction :firstprint ]
      If [Auction:: Pattle number < Auction::lastprint ]
         Go to Field [Auction:: Pattle number ]
         Enter Find Mode [Specified Find Requests: Find Records; Criteria: Auction:: Pattle number: "=pattle number" ] [ Restore; Pause ]
         Perform Find [Specified Find Requests: Find Records; Criteria: Auction:: Pattle number: "=pattle number" ] [ Restore ]
         If [Auction::Total>0 ]
            Print [ ]
         End If
         Set Field By Name [Auction:: Pattle number = Auction:: Pattle number+1 ]
      End If
      Enter Browse Mode 

        • 1. Re: Printing script problem fm 10
          TSGal

          nealt:

           

          First, I edited your post so it would be easier to read.

           

          In your "Set Field By Name" script steps, you only have one parameter.  What is the calculated field name returned?

           

          I know nothing happens when your run this script.  Do you have an idea where it is failing?  Can you let me know what you are trying to accomplish?  This may give me a clue where to start looking.

           

          TSGal

          FileMaker, Inc. 

          • 2. Re: Printing script problem fm 10
            nealt
               I want to sequencially find and print records that are displayed in the table view from a range of firstprint to lastprint in the paddle number field. When I run it Iget message "norecords match your request.
            • 3. Re: Printing script problem fm 10
              TSGal

              nealt:

               

              Okay.  Now you are getting a message.  That's a step in the right direction.

               

              Since no records match your request, the find is failing.

               

              In your Set Records By Name calculation, I only see one parameter.  Can you calculations/parameters?

               

              What calculated field is being set up for the find request?

               

              TSGal

              FileMaker, Inc. 

              • 4. Re: Printing script problem fm 10
                nealt
                  

                First I modified the script:

                Print Range
                Open File [ "Auction" ]

                Enter Browse Mode Show All Records
                Go to Layout [ "Invoices" (Auction) ]
                Show Custom Dialog [Title: "Field Range"; Buttons: "OK", "Cancel"; Input #1: Auction::firstprint, "From Paddle #"; Input #2: Auction:: lastprint, "To paddle #" ]
                Set Field [ Auction: presentrecord; Auction: presentrecord=Auction::firstprint ]
                Loop
                   Set Field By Name [ Auction: presentrecord; Auction: presentrecord = Auction::firstprint ]
                   Exit Loop If [ Auction: :Iastprint <Auction: presentrecord ]
                   Enter Find Mode [ ]
                   Set Field By Name [ Auction: pattle number; Auction: presentrecord ] Perform Find [ 1
                   Print [ ]
                   Set Field [Auction: pattle number; Auction: pattle number= Auction: pattle number + 1 ]
                End Loop
                Enter Browse Mode

                 

                What seems to be the problem is getting Auction: present record into Find.

                • 5. Re: Printing script problem fm 10
                  nealt
                     On my previous reply the smiley faces should be "p".
                  • 6. Re: Printing script problem fm 10
                    TSGal

                    nealt:

                     

                    Thank you for the information.

                     

                    Let me double-check everything.

                     

                    You are opening the file "Auction", entering Browse mode showing all records, and going to the layout "Invoices".

                     

                    You are entering information into the fields "firstprint" and "lastprint" of the first record.  If these are global fields, then they will appear in every record.

                     

                    You are then setting the value of "presentrecord" to either 1 or 0 (depending on the value of firstprint).

                     

                    We then enter the loop...

                     

                    The presentrecord field is being set to 1 or 0, depending on the value of firstprint.

                    The loop is exited if lastprint < presentrecord.  If lastprint is negative, or if lastprint is 0 when presentrecord is 1, then the loop is exited.

                    We enter Find mode and set pattle number to either 0 or 1 and perform the Find.  If no records are found, you will receive an error message.  You may want to Set Error Capture [On] prior to the find so you can capture the error message and display your own message.

                    Next, you Print.

                    After printing, you set the pattle number to the expression pattle number= pattle number + 1, which will never be equal, so the value is zero.

                    The loop ends and we repeat until lastprint is less than presentrecord.

                     

                    Is this what you are expecting to happen?

                     

                    TSGal

                    FileMaker, Inc.