12 Replies Latest reply on Jun 13, 2016 2:51 AM by tkemmere

    Distributing Reports Challenge

    rmittelman

      I have an FMP 13 application that prepares reports for our members. I want the option of bringing up the report(s) in preview mode or emailing to members, or both.

       

      So far, I've figured out how to bring up the reports, save them to pdf, and also how to email our members, even adding an attachment to the email. Unfortunately, I have run into a limitation. Without using a plugin or AppleScript, I can only attach a single file to each email. Logically, there are 3 ways around this that I can see:

       

      1. Multiple emails to each person, one for each attachment
      2. Zip the multiple PDF's into a single zip file, and attach that
      3. Append each PDF to the same file, then email that

       

      I'm eliminating #1 for efficiency.

       

      I've tried #3, but am running into an issue. Of 3 possible reports (so far), one is landscape and the others are portrait. When I append them all into a file, the resulting PDF is ALL landscape. I expected that the portrait report portions should appear portrait and landscape portions should appear landscape. This does not happen. Since all pages are landscape, the portrait pages are all messed up, especially those that are formatted as labels. I put a script step in each report script (which are called sequentially by controlling script) to execute the print setup dialog, but this doesn't fix the issue. Any ideas?

       

      I haven't tried #2, not sure how to do this without 3rd party tool.

       

      Can anybody suggest the proper way to solve this challenge? Thanks in advance...

        • 1. Re: Distributing Reports Challenge
          mikebeargie

          Use an email plugin that supports the sending of multiple attachments would be #4, and also the easiest way to send multiple PDFs.

           

          #2 can be accomplished with applescript but it's pretty difficult, plugin is easier.

           

          With #3, I have successfully done mixed landscape/portrait PDFs before, make sure you set a "print setup" script step before each PDF save, else it will just use your default setting. FM does not know if your layout is portrait or landscape, you have to tell it what to use.

          • 2. Re: Distributing Reports Challenge
            jrenfrew

            Other more technical version is to create a function with ScriptMaster and iText to add (concatenate) the various PDF files which you have previously created....

            This would be possible with a switch to force all pages to landscape or portrait. And another one to reduce oversized pages, or leave them alone so you could happily mix A4, A4 and A3..

            • 3. Re: Distributing Reports Challenge
              rmittelman

              Thanks Mike.

               

              You are right, I forgot to mention #4.

              #3 is just plain not working for me.  It does append the PDFs, but if any of them are landscape, all of them appear landscape.  This happens even if there is a print setup script step before saving.  I may be doing this incorrectly, however.  Here is the basic sequence:

               

              There is a main Reports script which runs a script for each individual report.  The individual report script opens a new window, goes to the report layout, then enters preview mode.  Therefore I now have the main layout window and 3 floating windows above with each report (if I've chosen to print 3 reports of course).  If I've chosen to also save and export the reports to PDF, the main script then creates the PDF and closes the report window.

               

              I thought putting the print setup step in each individual script would be enough.  Now I realize maybe I need to put that step just before I go to create the individual PDFs.  That would involve "remembering" which of the reports are landscape and which are portrait.  I will try this.

               

              Also, I did find some AppleScript code which lets you browse to select various files then appends them to PDF file properly.  I will first attempt changing when the print setup step occurs, then if that doesn't work look at the AS method, or see if I can find a plugin.

               

              Part of the challenge will be getting this to work both on Mac / PC (which should be easy enough), but also on iPad, which seems more difficult.

               

              Thanks again...

              • 4. Re: Distributing Reports Challenge
                Stephen Huston

                It was noted in another thread to day that the PDF Append option does not work on FMGo/iPad. Just offered as a heads-up so you don't bang your head on that wall too hard.

                1 of 1 people found this helpful
                • 5. Re: Distributing Reports Challenge
                  rmittelman

                  Thanks Stephen,

                   

                  What I'm really after is a way to generate multiple emails to multiple recipients with one or more files attached to each.  Most of this seems doable with Mac / PC, either using plugins or AppleScript / VBScript.

                   

                  I'm totally in the dark at this point what to do about the iPad version of the app.  I know it works considerably differently.  If only 1 PDF file can be generated at a time, and added to an email with multiple recipients, that may be adequate.

                   

                  Thanks again...

                  • 6. Re: Distributing Reports Challenge
                    rmittelman

                    Thanks Mike,

                     

                    I was able to create a script which can combine several PDFs into one, by calling AppleScript, and which honors the orientation of each individual PDF.  Therefore, I could send the multiple PDFs required from within a FM script.  This, however is only 1 use case.  The other one is to combine several reports, some of which may be PDFs and some of which may be Excel workbooks.  In this case, zipping the files into a single file would be appropriate.

                     

                    I will evaluate doing this with AppleScript.  If that indeed proves too complex, is there a suggestion for a plugin (preferably free)?

                     

                    Getting this functionality on GO would be problematic.  I will need to re-evaluate how to do this.

                     

                    Thanks...

                    • 7. Re: Distributing Reports Challenge
                      merlinfm

                      One solution, a little bit technical, is using Php Pill and Tcpdf. This great!

                      • 8. Re: Distributing Reports Challenge
                        rmittelman

                        Now I have a simple AppleScript to combine PDF's, and another one to zip several files.  Both are called with a list of (OutputFilePath ; InputFilePath ; InputFilePath { ; ...} )  It works great.  YAY!

                         

                        Now I notice an issue.  This is a slight deviation, but still related to the original topic.

                         

                        Each type of report has its own script, which opens the report in preview mode in its own window.

                        Some reports are based on the current found set, while some need to be for all records.

                         

                        The reports for all records have these 2 script steps:

                        Show All Records

                        Perform Find [Restore]

                         

                        So I notice that when printing only a report which uses the found set, everything works fine, but when I print 2 reports, one for the found set and one for all records, then the "filtered" report actually comes out with ALL records showing.

                         

                        This doesn't change the fact that my main layout window continues to display the found set after I close the report windows.

                         

                        Is there any way to make this work as intended (only show all records for the "all records" report window, and not for the "filtered" report window)?

                         

                        Thanks...

                        • 9. Re: Distributing Reports Challenge
                          rmittelman

                          I solved this myself (hopefully the proper way).

                           

                          Since the "all records" type reports needed a Show All Records script step so they wouldn't just reflect the found set, that was messing up the "found set" type reports.  In each of those scripts, I put another Perform Find, reflecting the current found-set filter.

                          • 10. Re: Distributing Reports Challenge
                            tkemmere

                            @wrote:

                            I have successfully done mixed landscape/portrait PDFs before, make sure you set a "print setup" script step before each PDF save

                            I tried that and it works well. The PDF result is how I'd like it.

                             

                            But the content matter that I print to PDF is a subsummary report. And I would also like to preview it on screen in Preview mode. But 95% of the Filemaker file is Portrait, and the [File > Print setup] is therefore set to portrait. As a result the report gets cut of along the right side.

                             

                            I wonder whether there's a solution for this?

                             

                            Cheers, Thomas.

                            • 11. Re: Distributing Reports Challenge
                              mikebeargie

                              You can try setting the zoom level out further (EG 50%) when in preview mode, and then back to 100% for browse mode. Usually I do that in cases where landscape reports need to fit.

                              • 12. Re: Distributing Reports Challenge
                                tkemmere

                                mikebeargie Yes that works! Thanks for your reply.

                                It took me a while to get back to this as i work part time. But none the less a usefull trick! :-) Thank you.

                                Regards, Thomas.