1 2 Previous Next 20 Replies Latest reply on Jan 17, 2014 9:13 AM by jrenfrew

    Sending PDF reports from server

    side

      Hi,

       

      I have an attendance report that I would like to produce and send by email every day at 11 PM.

      Is there a way of creating and sending reports to email adresses directly from the server since the script step SAVE RECORD AS PDF is not available from the server side?

       

      Thanks

        • 1. Re: Sending PDF reports from server
          pminich

          To the best of my knowledge you can only do that from a client. We keep a

          separate client "robot" machine for that and use the scriptfire plugin to

          schedule automated reports.

           

          --

          iPhone

          Pete Minich

           

           

          Direct/FaceTime/Text  - 781.223.8884

          • 2. Re: Sending PDF reports from server
            side

            Looked at the scriptfire plugin and it seems a bit too complicated for my intentions.  Seems like Filemaker is missing something here.  I don't know the limitations for the server not beeing engineered for saving to PDF.

            I will be waiting to see if other solutions come in!

             

            Thanks

            • 3. Re: Sending PDF reports from server
              pminich

              The documentation makes it look way more difficult than it is to implement.

               

              --

              iPhone

              Pete Minich

               

               

              Direct/FaceTime/Text  - 781.223.8884

              • 4. Re: Sending PDF reports from server
                mikebeargie

                Is a format other than PDF acceptable? IE could you save it as an XLSX report instead? THAT would be the simplest options with no complications.

                 

                Otherwise you might be waiting a while for other solutions. There is no native support for PDF generation from FileMaker Server.

                 

                360Works has "scribe", a plugin that can insert data into PDF forms, that might be an option for you. They also have "RemoteScripter", which like scriptfire, runs a robot machine to generate reports on demand.

                 

                Another solution would be to have your FileMaker schedule split into two parts:

                1) A script sequence schedule would export the data to a designated location, then launch a batch file that loads that data into a PDF report generator program of some kind (no idea what program, that would be the complicated part of this), which would generate a PDF with the data file to a specific location on the server.

                2) A regular script schedule would then run (on a ~5 minute delay), to email the PDF.

                 

                Lastly, you might also be able to setup a web application that you pass an array of data to, and it returns a PDF. Then you would be able to use Insert From URL to place the returned PDF into a container field, which you could then send as an attachment.

                 

                Native PDF generation from the server has been on the request list for a few versions now. Even moreso now that "perform script on server" was introduced.

                • 5. Re: Sending PDF reports from server
                  side

                  Hi Mike,

                   

                  XLSX would probably do the trick.

                  What are the steps?

                   

                  Thanks!

                  • 6. Re: Sending PDF reports from server
                    monkeybreadsoftware

                    Why not run a copy of FM Pro on the same Mac which does the reports?

                    • 7. Re: Sending PDF reports from server
                      mikebeargie

                      set variable $file = "file:" & get(documentspath) & "reportname.xlsx"

                      Go To Layout – whatever layout

                      Perform find – whatever find

                      sort – whatever order

                      Export Records – specify file = $file, XLSX type, whatever fields and options you need

                      if (get(lasterror) =/= 0

                         exit script – result = get(lasterror)

                      else

                         send email – to whomever, subject whatever, body whatever, attachment = $file, specify tested SMTP settings.

                      end if

                       

                      There's a bit of error checking there in case something goes wrong on the export, it would show up in your server log.

                       

                      You might have to modify this slightly for server compatible steps.

                       

                      Good luck.

                      • 8. Re: Sending PDF reports from server
                        martinc

                        We have two robots running without plugins.  They just loop and pause for a period of time.  One loops about every 15 minutes for reporting and the other loops every 24 hours.  The 24 hour unit looks at what day it is and then steps into scripts for that day.  These are both for reporting primarily.  The daily one handles an import of accounting data as well.

                        • 9. Re: Sending PDF reports from server
                          RecPro

                          Hi,

                           

                          We had tested various solutions for this type of automated nightly PDF reporting from our FMS, and we have been using the following workflow for the past few months with great success.

                           

                          1) A WIN scheduled task runs each morning at 7 am to open a batch file on the server.

                          2) The simple batch file opens the FM client application installed on the server machine and it also opens a FM "Robot" file hosted on the FMS.

                          3) On "first window open", the FM "Robot" file calls the script in the main file to generate all the PDF reports, store them in the system and email them to the appropriate staff.

                          4) The "Robot" file then closes after a specified period of time.

                           

                          Obviously this ties up a FM client license on the FMS machine, but we normally do that as part of our routine configuration.  This process has been very dependable, with the added benefit that files are not open on the FMS machine other than the period when the reports are actually being run.

                           

                          Hope that helps.

                          • 10. Re: Sending PDF reports from server
                            martinc

                            Hello Paul,

                             

                            That workflow sounds great.

                            Sadly, I'm not familiar with writing batch files.  Is it possible to post the guts of the code that I could pass to our IT guys?  The idea of keep the seat(s) open is very appealing.

                             

                            Thx

                             

                            Martin

                            • 11. Re: Sending PDF reports from server
                              pminich

                              Is the robot file just a front end for reporting purposes that hooks into the data file?

                              • 12. Re: Sending PDF reports from server
                                RecPro

                                Hi Martin,

                                 

                                Here is a screenshot of the batch file:

                                RobotBatchFile.png

                                In it's simplest form, we had the FM "Robot" file (WR_Robot.fmp12) in a local directory (RecPro) on the server machine.

                                 

                                Pete, the "Robot" file contains no data and only the "on first window open" script to remotely call the actual report generation scripts in the main system file.  We had initially tried to call the report generation scripts directly from the batch file, but we were unable to get the authentication and timing to function properly.

                                 

                                Please let me know if you have any other questions.  HTH

                                • 13. Re: Sending PDF reports from server
                                  pminich

                                  Thanks, I was wondering why you needed a 2 step operation. I have accomplished a similar solution on a mac using AppleScript in 1 step. It was triggered as an alarm with Calendar. I think that to accomplish it we had to include the username and password in the script so it did present a security hole.

                                  • 14. Re: Sending PDF reports from server
                                    jrenfrew

                                    Using plugin and a bit of writing code, create a function which absolutley can create the PDF on Server 13.

                                     

                                    I have it working with no issues and the PDF can be easily created direct to a container field so you have a record of it...

                                     

                                    I would agree it is not a 'trivial' task but it is some proper integration work. Seems SO much easier than managing robot machines from batch files - to  me at least

                                     

                                    john

                                    1 2 Previous Next