10 Replies Latest reply on May 12, 2016 9:46 AM by stevestearns

    Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?

    bmusich

      We have to print many records to PDF and doing them one at a time will take forever. Is there a better way?

       

      Boris

        • 1. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
          erolst

          A basic script would look like so:

           

          Go to Layout [ … ]

          # [ your print layout ]

          # [ find your records ]

          Go to Record [ first ]

          Set Variable [ $path ; … // e.g. Get ( DesktopPath ) & "pdf folder" )

          Loop

            Set Variable [ $fileName ; … ]

            # [ calculate a unique file name for each, lest you overwrite any previously created file ]

            Set Variable [ $savePath ; $path & $fileName ]

            Save Records as PDF [ … ; path: $savePath ]

            Go to Record [ next ; exit on last ]

          End Loop

           

          It becomes more complicated if e.g. you wanted to export orders (invoices, purchases …); you would browse through the order table, but export from a layout based on the related line items table.

          • 2. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
            stevestearns

            The answer is "Yes." I do this myself to produce individual notifications as .pdfs. The example script is below.

             

            There is an error in the script that I have not figured out at the end, where it goes to the first record (all records) and produces a second notification, but when I have some time I will resolve that.

             

            This script finds the records that notifications have not been sent, marks records, and then loops through the records producing filenames based upon several fields, and places the .pdf in specific folders depending upon the criteria (email or no email).

             

            Go to Layout [ “ActionItems [Mac OS X]” (ActionItems) ]

            Enter Browse Mode
            Set Error Capture
            [ On ]

            Enter Find Mode [ Specified Find Requests: Find Records; Criteria: ActionItems::InitialDisposition: “Warning” AND ActionItems:: WarningFineNotificationDate: “=”

            Find Records; Criteria: ActionItems::InitialDisposition: “Fine” AND ActionItems::WarningFineNotificationDate: “=”
            Find Records; Criteria: ActionItems::InitialDisposition: “Restoration” AND ActionItems::WarningFineNotificationDate: “=” Omit Records; Criteria: ActionItems::IdentificationDate: “<=1/29/2016” ]
            [ Restore ]

            Perform Find [ ]
            If [ Get ( FoundCount ) = 0 ]

            Show Custom Dialog [ Message: "There are no notifications found at this time."; Default Button: “OK”, Commit: “Yes” ]

            Exit Script [ Result: Get ( FoundCount ) = 0 ]

            Else

            Go to Record/Request/Page

            [ First ]

            Loop
            If
            [ IsEmpty ( ActionItems::UUID ) ]

            Set Field [ ActionItems::UUID; Get ( UUID ) ]

            End If

            Set Field [ ActionItems::WarningFineNotificationDate; Get ( CurrentDate ) ]
            If [ IsEmpty ( ActionItems::DeadlineDate ) and ActionItems::InitialDisposition = "Warning" ]

            Set Field [ ActionItems::DeadlineDate; ActionItems::WarningFineNotificationDate + 4 ]

            Else

            Set Field [ ActionItems::DeadlineDate; ActionItems::IdentificationDate ]

            Set Field [ ActionItems::FineNotificationDate; ActionItems::IdentificationDate ]

            End If

            Set Field [ ActionItems::MarkRecord2; 1 ]
            Replace Field Contents [ ActionItems::MarkRecord2 ]

            [ No dialog ]

            Set Field [ ActionItems::MarkRecord3; 1 ]

            Replace Field Contents [ ActionItems::MarkRecord3 ] [ No dialog ]

            Commit Records/Requests

            [ Skip data entry validation; No dialog ]

            Go to Record/Request/Page

            [ Next; Exit after last ]

            End Loop End If

            #Prepare individual notifications #

            Go to Layout [ “ActionItems [Mac OS X]” (ActionItems) ]

            Enter Find Mode [ ]
            Set Field [ ActionItems::MarkRecord3; 1 ]
            Perform Find [ ]

            Go to Record/Request/Page

            [ First ]

            Loop
            Enter Browse Mode
            Set Variable
            [ $UUID; Value:ActionItems::UUID ]
            Set Variable [ $OutputPathFile; Value:Case ( IsEmpty ( UnitOwners::Email ) ;

            "filemac:/Macintosh HD/Users/stevestearns/Documents/_ Active Projects/_Action Items/Mail-To-Unit-Owners/" & Year

            ( ActionItems::WarningFineNotificationDate ) & "-" &

            If ( Month ( ActionItems::WarningFineNotificationDate ) < 10 ; "0" & Month ( ActionItems::WarningFineNotificationDate ) ;

            Month ( ActionItems::WarningFineNotificationDate ) ) & "-" &

            If ( Day ( ActionItems::WarningFineNotificationDate ) < 10 ; "0" & Day ( ActionItems::WarningFineNotificationDate ) ; Day

            ( ActionItems::WarningFineNotificationDate ) ) & "-Unit-" & ActionItems::UnitNo & "-" & ActionItems::InitialDisposition & "-" & Proper ( Substitute ( ActionItems::ShortDescription ; " " ; "-" ) ) & ".pdf" ;

            "filemac:/Macintosh HD/Users/stevestearns/Documents/_ Active Projects/_Action Items/Email-To-Unit-Owners/" & Year

            ( ActionItems::WarningFineNotificationDate ) & "-" &

            If ( Month ( ActionItems::WarningFineNotificationDate ) < 10 ; "0" & Month ( ActionItems::WarningFineNotificationDate ) ;

            Month ( ActionItems::WarningFineNotificationDate ) ) & "-" &

            If ( Day ( ActionItems::WarningFineNotificationDate ) < 10 ; "0" & Day ( ActionItems::WarningFineNotificationDate ) ; Day

            ( ActionItems::WarningFineNotificationDate ) ) & "-Unit-" & ActionItems::UnitNo & "-" & ActionItems::InitialDisposition & "-" & Proper ( Substitute ( ActionItems::ShortDescription ; " " ; "-" ) ) & ".pdf" ) ]

            Enter Find Mode [ ]
            Set Field [ ActionItems::UUID; $UUID ]

            Pause/Resume Script [ Duration (seconds): 1 ]

            Perform Find [ ]
            If [ ActionItems::InitialDisposition = "warning" ]

            Go to Layout [ “Warning Letter” (ActionItems) ]

            Else If [ ActionItems::InitialDisposition = "fine" ]

            Go to Layout [ “Fine Letter” (ActionItems) ]

            Else

            Go to Layout [ “Restoration Costs Letter” (ActionItems) ]

            End If

            Sort Records by Field [ Ascending; ActionItems::UUID ]

            Go to Record/Request/Page

            [ First ]

            Enter Preview Mode

            Save Records as PDF [ File Name: “$OutputPathFile”; Records being browsed ]
            [
            Document - Author: "Liberty Commons Condominium Trust"; Compatibility: Acrobat 7 and later ]
            [
            Pages - Number Pages From: 1; Include: All pages ]
            [
            Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ]

            [ Restore; No dialog ]

            Enter Browse Mode

            Go to Layout [ “ActionItems [Mac OS X]” (ActionItems) ]

            Clear [ ActionItems::MarkRecord3 ] [ Select ]

            Enter Find Mode [ ]
            Set Field [ ActionItems::MarkRecord3; 1 ]

            Perform Find [ ]
            If [ Get ( FoundCount ) = 0 ]

            Show All Records Else

            Enter Browse Mode
            Go to Record/Request/Page

            [ First ]

            End If

            End Loop

            Enter Browse Mode
            Go to Layout
            [ “ActionItems [Mac OS X]” (ActionItems) ]

             

            End If

            End Loop

            Set Error Capture [ Off ]

             

            If anyone has any suggestions for improvements or streamlining, I'd appreciate the feedback.

             

             

             

            • 3. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
              bmusich

              Steve:

               

              Thanks for your response. I’m not that technical-savvy but will see if one of the IT experts here can do this. Can all this be done from FileMaker Pro “out-of-the-box” or would we need a special version to do this programming?

               

              Thanks, again.

               

               

              Regards,

                Boris

              Boris Musich, Research Manager   |   KPMG LLP   |   AQPP Knowledge Services

              345 Park Ave., New York, NY 10154

              tel: 212-909-5632  |  bmusich@kpmg.com<mailto:bmusich@kpmg.com>

              • 4. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
                erolst

                stevestearns wrote:

                Set Variable [ $OutputPathFile; Value:Case ( IsEmpty ( UnitOwners::Email ) ;

                "filemac:/Macintosh HD/Users/stevestearns/Documents/_ Active Projects/_Action Items/Mail-To-Unit-Owners/" & Year

                ( ActionItems::WarningFineNotificationDate ) & "-" &

                If ( Month ( ActionItems::WarningFineNotificationDate ) < 10 ; "0" & Month ( ActionItems::WarningFineNotificationDate ) ;

                Month ( ActionItems::WarningFineNotificationDate ) ) & "-" &

                If ( Day ( ActionItems::WarningFineNotificationDate ) < 10 ; "0" & Day ( ActionItems::WarningFineNotificationDate ) ; Day

                ( ActionItems::WarningFineNotificationDate ) ) & "-Unit-" & ActionItems::UnitNo & "-" & ActionItems::InitialDisposition & "-" & Proper ( Substitute ( ActionItems::ShortDescription ; " " ; "-" ) ) & ".pdf" ;

                "filemac:/Macintosh HD/Users/stevestearns/Documents/_ Active Projects/_Action Items/Email-To-Unit-Owners/" & Year

                ( ActionItems::WarningFineNotificationDate ) & "-" &

                If ( Month ( ActionItems::WarningFineNotificationDate ) < 10 ; "0" & Month ( ActionItems::WarningFineNotificationDate ) ;

                Month ( ActionItems::WarningFineNotificationDate ) ) & "-" &

                If ( Day ( ActionItems::WarningFineNotificationDate ) < 10 ; "0" & Day ( ActionItems::WarningFineNotificationDate ) ; Day

                ( ActionItems::WarningFineNotificationDate ) ) & "-Unit-" & ActionItems::UnitNo & "-" & ActionItems::InitialDisposition & "-" & Proper ( Substitute ( ActionItems::ShortDescription ; " " ; "-" ) ) & ".pdf" ) ]

                 

                 

                If anyone has any suggestions for improvements or streamlining, I'd appreciate the feedback.

                 

                 

                First thing I would streamline is your monstrosity of a calculation:

                 

                Let ( [

                  theFolderPath = "filemac:/Macintosh HD/Users/stevestearns/Documents/_ Active Projects/_Action Items/" ;

                // which shouldn't necessarily be hardcoded into a calculation …

                  theReceivingFolder =  Case ( IsEmpty ( UnitOwners::Email ) ; "Mail-To-Unit-Owners/" ; "Email-To-Unit-Owners/" ) ;

                 

                  notificationDate = ActionItems::WarningFineNotificationDate ;

                  theFileName =

                    Year ( notificationDate ) & "-" &

                    SerialIncrement ( "00" ; Month ( notificationDate ) ) & "-" &

                    SerialIncrement ( "00" ; Day ( notificationDate) ) &

                    "-Unit-" & ActionItems::UnitNo & "-" &

                    ActionItems::InitialDisposition & "-" &

                    Proper ( Substitute ( ActionItems::ShortDescription ; " " ; "-" ) ) & ".pdf"

                ] ;

                  theFolderPath & theReceivingFolder & theFileName

                )

                1 of 1 people found this helpful
                • 5. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
                  bmusich

                  Erolst:

                   

                  Thanks for the information. Can this be done using FM Pro “out-of-the-box”? I have never done a script in FM Pro.

                   

                  Thanks again.

                   

                   

                  Regards,

                    Boris

                  Boris Musich, Research Manager   |   KPMG LLP   |   AQPP Knowledge Services

                  345 Park Ave., New York, NY 10154

                  tel: 212-909-5632  |  bmusich@kpmg.com<mailto:bmusich@kpmg.com>

                  • 6. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
                    stevestearns

                    Boris:

                     

                    This is all out-of-the-box FileMaker Pro. If you have someone who has used scripting in FileMaker they can probably follow the script and adapt it to your needs.

                     

                    --

                    Steve

                    • 7. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
                      erolst

                      bmusich wrote:

                      Can this be done using FM Pro “out-of-the-box”?

                      Hi Boris –

                       

                      absolutely. Scripting is an integral & essential part of FM, exactly for cases like yours: automating repetitive tasks.

                       

                      See Creating scripts to automate tasks for the official documentation, or search the web for more learning resources.

                      • 9. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
                        bmusich

                        Steve:

                         

                        If we can’t do this script in-house, are there FM Pro consultants out there who could do it for us? Can you recommend anybody?

                         

                        Thanks.

                         

                        Regards,

                         

                        Boris

                        • 10. Re: Is there a way to print multiple FM Pro records to individual PDF files? For example, can I print 100 records into 100 individual PDF files in one go, or must I do them one at a time?
                          stevestearns

                          Boris:

                           

                          There is a network of FileMaker consultants. I don't know anyone to recommend in the New York area, but you can search:

                           

                          FileMaker Consultants, Data Consultants, Database Consultants

                           

                          I hope this helps you,

                          --

                          Steve