1 2 Previous Next 25 Replies Latest reply on Dec 13, 2011 4:48 AM by NaturSalus

    Print Record Script not able to Print Current Record

    NaturSalus

      Title

      Print Record Script not able to Print Current Record

      Post


      Hello,


      All the data of my current project come from the DEVIATION table


      In order to generate and print a Report that contains data counts per Year, Quarter, Month, Deviation Origin, and Deviation Subject I have set up the Deviation History Report Layout (Default view: List view) based on the DEVIATION table.


      Deviation History Report Layout Structure


      The Deviation Report layout has the following structure:

       

      HEADER that contains the "Deviation Report" text and "Total" text


      Sub_summary by z_DateDeviationYear (Leading) that contains the folllowing fields:

      DEVIATION::z_DateDeviationYear and DEVIATION::DeviationCount

       

      Sub_summary by z_Quarter (Leading) that contains the folllowing fields:

      DEVIATION::z_Quarter and DEVIATION::DeviationCount

       

      Sub_summary by z_DateDeviationMonth(Leading) that contains the folllowing fields:

      DEVIATION::z_DateDeviationMonthDate and DEVIATION::DeviationCount

       

      Sub_summary by DeviationOrigin (Leading) that contains the folllowing fields:

      DEVIATION::DeviationOrigin and DEVIATION::DeviationCount


      Sub_summary by DeviationSubject (Leading) that contains the folllowing fields:

      DEVIATION::DeviationSubject and DEVIATION::DeviationCount


      FOOTER with the Date Printed and Page Number



      Deviation History Report Structure Purpose


      The purpose of the Deviation Report is to come out with the following basic report:

       

      Deviation Report                                    Total

      Year                                                       Number of Deviations per Year

      Quarter                                                   Number of Deviations per Quarter

      Month                                                    Number of Deviations per Month

      Deviation Origin                                    Number of Deviations per type of Deviation Origin

      Deviation Subject                                  Number of Deviations per type of Deviation Subject



       

      On the Deviation Detail Layout, based on the DEVIATION table, I have a Print icon attached to the Print Report Script.

       

      The Print Report Script generates and prints reports based on the user choice of: “All”, “Current” or “Cancel” to the question: Would you like to print the deviation in the found set or just the current contact?

       

      The contents of the Print Report Script are the following:


      Allow User Abort [ Off ]

      Set Error Capture [ On ]

      Enter Browse Mode

      New Window [ ]

      Adjust Window [ Maximize ]

      Go to Layout [ “Deviation_History_Report ” (DEVIATION) ]

      Show Custom Dialog [ Title: "All or Current?"; Message: "Would you like to print the deviation in the found set or just the current contact?"; Buttons: “All”, “Current”, “Cancel” ]

      If [ Get(LastMessageChoice) = 1 ]

      Show All Records

      Sort Records [ Restore; No dialog ]

      Print [ Restore: Samsung ML-2010 Series ]

      Else If [ Get(LastMessageChoice) = 2 ]

      Show All Records

      Omit Record

      Show Omitted Only

      Sort Records [ Restore; No dialog ]

      Print [ Restore: Samsung ML-2010 Series ]

      End If

      Adjust Window [ Restore ]

      Go to Layout [ original layout ]



      The “record showing” part of the Print Record Script works fine since:

      • it shows all the records if the user chooses “All”

      • it shows just the current record if the user chooses “Current”

      • cancels if the user chooses “Cancel”



      The problem lies with the “record printing” part of the Print Record Script since:

      • when the user chooses “All”, it prints all the records as expected.

      • when the user chooses “Current”, it prints just the Header and Footer part of the Report and not the contents of the Subsummary parts



      So, even though I can preview the current record correctly I cannot print it, neither to a printer neither to a PDF file.


      Although without any logical basic, I tried to change the Default View of the Deviation History Report layout from List View to Form View, but it didn't make any difference.

      At this point I have no clue whether the problem is in the Deviation History Report layout settings and/or the contents of the Print Record Script.



      Any help to make it work is greatly appreciated.


      natursalus

        • 1. Re: Print Record Script not able to Print Current Record
          philmodjunk

          Since you can browse the report scuccessfully, when current record is specified, what happens if you temporarily remove or disable the print step an select print from the File menu? Does that work?

          What do you see if you preview the report at that point by entering Preview mode?

          • 2. Re: Print Record Script not able to Print Current Record
            NaturSalus

            Hello Phil,

             

            Since you can browse the report scuccessfully, when current record is specified, what happens if you temporarily remove or disable the print step an select print from the File menu? Does that work?

             

            Allow User Abort [ Off ]

            Set Error Capture [ On ]

            Enter Browse Mode

            New Window [ ]

            Adjust Window [ Maximize ]

            Go to Layout [ “Deviation_History_Report ” (DEVIATION) ]

            Show Custom Dialog [ Title: "All or Current?"; Message: "Would you like to print the deviation in the found set or just the current contact?"; Buttons: “All”, “Current”, “Cancel” ]

            If [ Get(LastMessageChoice) = 1 ]

            Show All Records

            Sort Records [ Restore; No dialog ]

            Print [ Restore: Samsung ML-2010 Series ]

            Else If [ Get(LastMessageChoice) = 2 ]

            Show All Records

            Omit Record

            Show Omitted Only

            Sort Records [ Restore; No dialog ]

            // Print [ Restore: Samsung ML-2010 Series ]

            End If

            Adjust Window [ Restore ]

            Go to Layout [ original layout ]

             

            If I do that I get a printout of the current record from the Deviation Detail layout instead of from the Deviation History Report layout

            Additionally, I cannot preview the current record from the Deviation History Report layout.

             

            What do you see if you preview the report at that point by entering Preview mode?


            Allow User Abort [ Off ]

            Set Error Capture [ On ]

            Enter Browse Mode

            New Window [ ]

            Adjust Window [ Maximize ]

            Go to Layout [ “Deviation_History_Report ” (DEVIATION) ]

            Show Custom Dialog [ Title: "All or Current?"; Message: "Would you like to print the deviation in the found set or just the current contact?"; Buttons: “All”, “Current”, “Cancel” ]

            If [ Get(LastMessageChoice) = 1 ]

            Show All Records

            Sort Records [ Restore; No dialog ]

            Print [ Restore: Samsung ML-2010 Series ]

            Else If [ Get(LastMessageChoice) = 2 ]

            Show All Records

            Omit Record

            Show Omitted Only

            Sort Records [ Restore; No dialog ]

            Enter Preview Mode []

            // Print [ Restore: Samsung ML-2010 Series ]

            End If

            Adjust Window [ Restore ]

            Go to Layout [ original layout ]


            I can preview the current record from the the Deviation History Report layout, as expected. See attached picture.

             

             

            Thanks,

             

            natursalus

             


            • 3. Re: Print Record Script not able to Print Current Record
              philmodjunk

              I don't see any attached picture. make sure that it is jpg, gif or png before uploading.

              In my original suggestion, you'd also need to use a copy that halts the script on the report layout after sorting so that you can manually print the report. These tests are intended to determine whether the issue lies with your print or your sort script steps by examing the behavior of each in isolation.

              • 4. Re: Print Record Script not able to Print Current Record
                NaturSalus

                 

                I don't see any attached picture. make sure that it is jpg, gif or png before uploading.

                 

                I can see the picture before publishing it, but it is no tpublished. Several tries but no luck.

                 

                In my original suggestion, you'd also need to use a copy that halts the script on the report layout after sorting so that you can manually print the report. 

                 

                Allow User Abort [ Off ]

                Set Error Capture [ On ]

                Enter Browse Mode

                New Window [ ]

                Adjust Window [ Maximize ]

                Go to Layout [ “Deviation_History_Report ” (DEVIATION) ]

                Show Custom Dialog [ Title: "All or Current?"; Message: "Would you like to print the deviation in the found set or just the current contact?"; Buttons: “All”, “Current”, “Cancel” ]

                If [ Get(LastMessageChoice) = 1 ]

                Show All Records

                Sort Records [ Restore; No dialog ]

                Print [ Restore: Samsung ML-2010 Series ]

                Else If [ Get(LastMessageChoice) = 2 ]

                Show All Records

                Omit Record

                Show Omitted Only

                Sort Records [ Restore; No dialog ]

                Pause/resume Script [Indefinitely]

                // Print [ Restore: Samsung ML-2010 Series ]

                End If

                Adjust Window [ Restore ]

                Go to Layout [ original layout ]


                When the modified script is run, as per your first set of modifications, I am getting the same screen that I got with just the second set of modifications that you suggested (Enter Preview Mode [])

                Since the picture cannot be uploaded, I will describe it:

                Deviation History Report

                                                                Total

                Year: 2009                                 1

                Quarter: 3                                      1

                Month: September                               1   

                Deviation Origin: Inspection                      1

                Deviation Subject:Facility                                1

                 

                And I get the following message:

                 

                Would you like to print the deviation in the found set or just the current record?

                Cancel  Current  All

                 

                If I choose Current, the Script is Paused.

                If I go File -> Print  I get: Print current record

                and if I goo ahead a Print it, I am getting the same problem that I have been reported. I get A printout with the data of the Header and Footer by no data from the Subsummaries parts of the Deviation History Report.

                 

                So, even though I can preview the current record correctly I cannot print it, neither to a printer neither to a PDF file.

                 Maybe the problem lies with the Deviation History Report layout.

                Thanks,

                 

                natursalus

                • 5. Re: Print Record Script not able to Print Current Record
                  philmodjunk

                  I can see the picture before publishing it, but it is notpublished. Several tries but no luck.

                  Make sure that you use the Upload Image control located below Post A Answer.

                  With the script paused but before you print, what do you see on the screen? (This is FileMaker 10 or 11 not 9 or older?)

                  While it is paused, select sort from the records menu. Do you see the correct sort order specified that you need to see all of the sub smmary parts?

                  • 6. Re: Print Record Script not able to Print Current Record
                    NaturSalus

                     

                    With the script paused but before you print, what do you see on the screen?

                    I see the data of the current record and the message described above.

                     

                    Deviation History Report

                                                                    Total

                    Year: 2009                                 1

                    Quarter: 3                                      1

                    Month: September                               1   

                    Deviation Origin: Inspection                      1

                    Deviation Subject:Facility                                1

                     

                    And I get the following message:

                     

                    Would you like to print the deviation in the found set or just the current record?

                    Cancel  Current  All

                     

                     

                    (This is FileMaker 10 or 11 not 9 or older?)

                     

                    It is FM 11 Pro Advanced.

                     

                     While it is paused, select sort from the records menu. 

                    When the script it is paused the Sort records option of the Records menu is not accesible.

                     Do you see the correct sort order specified that you need to see all of the sub smmary parts?

                    Yes  every time that I run the script.

                     

                     

                     

                    • 7. Re: Print Record Script not able to Print Current Record
                      NaturSalus

                      As I pointed out before, the problem is just with the current record not with the found set.

                      If I can preview right both the current record and the found set but can print right only the found set, it must be something related with the Deviation History Report layout. But, what?

                      • 8. Re: Print Record Script not able to Print Current Record
                        philmodjunk

                        Actually, I wanted to see what it looked like at the point where the script is paused, not where you get the custom dialog. We need to see the found set and sort order at that point--just before you print--to see if they might be a factor. After this custom dialog appears, you do a show all, show omitted and then sort your records so what we see in the above screen shot does not tell us what is current at the time the script prints.

                        • 9. Re: Print Record Script not able to Print Current Record
                          NaturSalus

                           

                          Okay Phil,

                          First of all there are aq total of 10 records.

                           

                          When I run the following script:

                          Allow User Abort [ Off ]

                          Set Error Capture [ On ]

                          Enter Browse Mode

                          New Window [ ]

                          Adjust Window [ Maximize ]

                          Go to Layout [ “Deviation_History_Report ” (DEVIATION) ]

                          Show Custom Dialog [ Title: "All or Current?"; Message: "Would you like to print the deviation in the found set or just the current contact?"; Buttons: “All”, “Current”, “Cancel” ]

                          If [ Get(LastMessageChoice) = 1 ]

                          Show All Records

                          Sort Records [ Restore; No dialog ]

                          Print [ Restore: Samsung ML-2010 Series ]

                          Else If [ Get(LastMessageChoice) = 2 ]

                          Show All Records

                          Omit Record

                          Show Omitted Only

                          Sort Records [ Restore; No dialog ]

                          Pause/resume Script [Indefinitely]

                          // Print [ Restore: Samsung ML-2010 Series ]

                          End If

                          Adjust Window [ Restore ]

                          Go to Layout [ original layout ]


                          The first screen shot is the following:

                          • 10. Re: Print Record Script not able to Print Current Record
                            NaturSalus

                            Now, if I choose All

                            I get the second screen

                            • 11. Re: Print Record Script not able to Print Current Record
                              NaturSalus

                              Now, if I choose OK

                              I get a perfect print out of all the records in the right order

                              And I end up in the original layout

                              • 12. Re: Print Record Script not able to Print Current Record
                                NaturSalus

                                Let us see what happens when I run the script again from the beginning and I select "Current"

                                First I run the script and get the following screen

                                • 13. Re: Print Record Script not able to Print Current Record
                                  NaturSalus

                                  After selecting "Current", I get the following screen

                                  • 14. Re: Print Record Script not able to Print Current Record
                                    philmodjunk

                                    Is this what you want to see?

                                    What happens when you print from the File menu or preview it?

                                    1 2 Previous Next