1 Reply Latest reply on Oct 29, 2009 12:45 PM by TSGal

    Print and send mail for each customer

    techccaq

      Title

      Print and send mail for each customer

      Post

      Hello,

       

      I have two tables.  One called "customers" and the other is "customers related".  We create a relationship with "ID_customers" on both table.

       

      The "customers" tables is connected by "ID_Customers" on table called Order_lines. 

       

      I create another "order_lines_for Customers_related" based on "Order Lines"(Occurrences).

       

      The "customers_related" table is connected by "ID_Customers_related" on table called "Order_lines_for_customers_related".  So, whatever I enter some lines in my order, I could have the other for my "customers" and my "customers related".

       

      So, I created a report from table "order_lines_for Customers_related".

       

      I have a Header containing the information for my customers.

       

      I have a sub-summary(Leading) sort by the first and last name of the "customers".  I select Page break before each occurence and restart pages numbers after each occurences.

       

      I have the body containing the name of the person that order some activities and also the cost for all the activities.

       

      I also have another sub summary (Trailing) sort by first and last name of the "customers".  This part contains informations about payment other information base on summary for billing.

       

      I finally have a footer containing the page number ( Page ##).

       

      I have 25 customers.  I expected to have 50 pages in my report.

       

      I just want to print a PDF file for each 25 customers ( 1 file by customer) and send it by mail to the right customer.

       

      I suppose that it could be done but how ?

       

      Do I need a loop in my script ?

       

      If I click on the preview mode, I could see all the pages and the information that I want but if i click on save as PDF, it print all my 50 pages.

        • 1. Re: Print and send mail for each customer
          TSGal

          techccaq:

           

          Thank you for your post.

           

          Yes, you can print out a PDF file for each person and attach the PDF to an email for that person.  Yes, you would need a script with a "loop".  Here is the basics of the script:

           

          Go to Record/Request/Page [ First ]

          Loop

             Save Records As PDF [ Restore ; No dialog ; "file:test.pdf" ; Current record ]

             Send Mail [ Send via E-mail Client ; No dialog ; To: <field name with email address> ; Subject: <subject you want> ; ....   ; "test.pdf" ]

             Go to Record/Request/Page [ Next ; Exit after last ]

          End Loop

           

          --------

           

          In essence, go to the first record in the found set and enter a loop.  We then save the "current record" information as PDF, and then Send Mail with the "test.pdf" file attachment.  Skip to the next record and repeat the process.  After the last record has been reached, the loop exits.

           

          This should get you pointed in the right direction.

           

          If you need clarification for any of the above steps, please let me know.

           

          TSGal

          FileMaker, Inc.