5 Replies Latest reply on Jan 31, 2012 1:17 AM by wtowers

    How to page through multiple pages in preview mode.

    wtowers

      Hi

       

      I have a database where there is a need to preview the content of a days activities many times during the day, and occasionally this will need to be printed out. This is easy for the first page, but if there are multiple pages I have to create a very lengthy script containing multiple 'IF' statements. 1 for each page available in the preview, this works fine for two or three pages but become a nightmare after that to get to work properly. I would appreciate some help here as I have done this database up for a non profit organisation and have donated it to them, and this is the only snag at the moment.

       

      Thanks

       

      Bill Towers.

        • 1. Re: How to page through multiple pages in preview mode.
          BruceHerbach

          Hi Bill,

           

          I'm not sure what you are doing with the multiple if statements...  I picked up a method of working with large reports that uses a layout keystroke script trigger to page through the report, print, save as pdf etc.   The initial setup is to open the report,  size and place the window Go to page last so you get the number of pages in the display,  then go page first.  Then finally pause the script.  The keystroke script is invoked through an on Layout keystroke script trigger.  Hitting an ESC or Return key continues the script which closes the report window.

           

          Below is the keystorke script with codes you need. 

           

          Hope this helps.  If you need more help with this please contact me.

          Bruce

          ------- script --------

          Set Error Capture [ On ]

          Set Variable [ $Keystroke; Value:Code ( Get ( TriggerKeystroke ) ) ]

          If [ $Keystroke = 112 or $Keystroke = 80 ]

            #User pressed 'P' or 'p': Print

             Perform Script [ “Preview_Print” ]

          Else If [ $Keystroke = 28 ]

            #User pressed left arrow: Go to page_Previous

             Perform Script [ “Preview_Go to page_Previous” ]

          Else If [ $Keystroke = 29 ]

            #User pressed up arrow: Go to page_First

             Perform Script [ “Preview_Go to page_First” ]

          Else If [ $Keystroke = 30 ]

            #User pressed right arrow: Go to page_Next

            Perform Script [ “Preview_Go to page_Next” ]

          Else If [ $Keystroke = 31 ]

            #User pressed down arrow: Go to page_Last

            Perform Script [ “Preview_Go to page_Last” ]

          Else If [ $Keystroke = 67 or $Keystroke = 99 ]

            #User pressed 'C' or 'c': Copy

            Perform Script [ “Preview_CopyToClipboard” ]

          Else If [ $Keystroke = 70 or $Keystroke = 102 ]

            #User pressed 'F' or 'f': Copy

          Perform Script [ “Preview_SaveAsPDF” ]

          End If

          1 of 1 people found this helpful
          • 2. Re: How to page through multiple pages in preview mode.
            RayCologon

            wtowers wrote:

            ...this works fine for two or three pages but become a nightmare after that to get to work properly...

             

            Hi Bill,

             

            In any script sequence where you may need to deal with multiple instances of similar code, one after another - and especially where you won't know in advance how many instances there will be on any specific occasion - you will likely find it better to dispense with code based on an If[ ] / End If sequance and use a Loop / Exit Loop If[ ] / End Loop construction instead.

             

            It's hard to be more specific than that without actually seeing the script, so if you want more detail, you may have to post a transcript of it here. But meanwhile, that may at least give you an alternative to explore.

             

            Regards,

            Ray

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

            R J Cologon, Ph.D.

            FileMaker Certified Developer

            Author, FileMaker Pro 10 Bible

            NightWing Enterprises, Melbourne, Australia

            http://www.nightwingenterprises.com

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

            1 of 1 people found this helpful
            • 3. Re: How to page through multiple pages in preview mode.
              wtowers

              Thanks for the help so far, I have attached the script that works. This is fine for small Radio Bases where there are only two or three pages of contacts daily but, some of the users can have up to ten pages or more a day.

               

              The script needs to find all contacts for the day and sort them chronologically then go to preview mode [this is for on screen checking of vessels which show in different colours depending on their status]. They need to be able to page through one by one until all the records have been viewed. The print option needs to be available but only to print all the pages, not individual pages.

               

              Thanks for you help this far. I am leaning towards the Loop.

               

              Bill Towers.

              • 4. Re: How to page through multiple pages in preview mode.
                RayCologon

                Hi Bill,

                 

                There are several options.

                 

                One relatively simple (and easy to implement) solution would be to insert into the Loop / End Loop sequence, a custom dialog, with its three buttons labelled Next, Print and Cancel respectively. After the dialog, the script will need an If[ ] / Else If[ ] / End If sequence to test for which button was clicked and perform the appropriate actions for Print and Cancel. However if the user clicks the Nedxt button, the dialog will be dismissed and they will pass around the loop to preview the next page.

                 

                If you need or want to provide more control than a custom dialog (with its three button limit) Will give you, you could either use a dialog plug-in, or better still, fashion a Preview Palette, along the lines of the one shown in the demo you'll find at the following link:

                 

                http://www.nightwingenterprises.com/demos7/demo704.html

                 

                Creating a Palette system is certainly a little more work, but arguably will produce a cleaner result and a better user experience.

                 

                Regards,

                Ray

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

                R J Cologon, Ph.D.

                FileMaker Certified Developer

                Author, FileMaker Pro 10 Bible

                NightWing Enterprises, Melbourne, Australia

                http://www.nightwingenterprises.com

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

                • 5. Re: How to page through multiple pages in preview mode.
                  wtowers

                  Thanks very much guys, it's great to get help so quick. I am only a novice developer and while I can figure out most thinks I get fairly regular senior moments (being over 60 I am allowed a few of them). 

                   

                  All three solutions have worked but, the best is the Preview palette, very simple to do and easy for the operators, most of who are not computer literate except for email.

                   

                  Thanks again

                   

                  Bill