9 Replies Latest reply on Jun 15, 2012 11:03 AM by JillX

    Email a pdf generated from layout in attachment

    JillX

      Title

      Email a pdf generated from layout in attachment

      Post

      In table Spec, I have fields

      Spec::Model

      Spec::Picture

      Spec::Title

      Spec::Description

      And a field for new value, Spec::Val

      I tried with

      Set Variable[$PDF;Value:Let (
      val = Case ( Abs ( Get ( SystemPlatform )) = 1; "filemac:"; "filewin:" );
      val & Get ( TemporaryPath ) & Spec::Model&Spec::Picture&Spec::Title&Spec::Description & ".pdf")

       

      And I got the error "the specified field can not be found" for field val.

      How can I send the pdf generated from this layout as attachment in email?

       

      Thank you!

        • 1. Re: Email a pdf generated from layout in attachment
          philmodjunk

          Usually, that indicates a syntax error in your expression. A parenthesis in the wrong place, a variable name is misspelled or something. I can't spot the error in the above expression that goes with your error message, however. Is this expression a direct copy and paste from FileMaker?

          You don't acutally need platform specific file paths here. You can actually use "file:" in place of "filemac:" and "filewin:" and it will work on both platforms. So you can simplify this expression to remove the need for your let function and the val temporary variable.

          • 2. Re: Email a pdf generated from layout in attachment
            JillX

            Everything after Let function was pasted from FMP, I tried again and got "The specified table can not be found" for table Spec.

            If I want to generated a pdf file from the spec layout and send by email in attachment, how can I achieve that?

             

            Thank you!

            • 3. Re: Email a pdf generated from layout in attachment
              JillX

              Now I have problem with the script to generate pdf form selected layout. How can I achieve this?

              • 4. Re: Email a pdf generated from layout in attachment
                philmodjunk

                And what is the problem? It's a bit hard to suggest anything if you don't describe the problem.

                You might look at this thread: Found Sets to PDF with unique file names

                • 5. Re: Email a pdf generated from layout in attachment
                  JillX

                  Now I have a new error code

                  "The specified table can not be found" for table Spec.

                  What may lead to this error?

                  • 6. Re: Email a pdf generated from layout in attachment
                    philmodjunk

                    The absence of a table occurrence named "spec" in Manage | Database | Relationships would explain this error message.

                    Like many other places in the program, this reference to a "table" really refers to the "boxes"--called table occurrences--found on the relationships tab. If You delete or rename the occurrence for your "spec" table, you will not be able to use Spec:: as the table occurrence name.

                    One tip to be sure your TableOccurrence::FieldName syntax is correct for a calculation is to add the fields to your expression by double clicking them from the list of fields just above the box where you enter a calculation.

                    • 7. Re: Email a pdf generated from layout in attachment
                      JillX

                      Thank you Phil! I get rid of the error now.

                      While there is another problem, I have dozens of fields on Table Spec, and I only need few fields listed above to generate as PDF. I set a new layout for the listed fields, but the script to generate PDF follows table and relationship in database.

                      The PDF I generated now only showes the Leading Grand Summary part of the whole layout, and why is that?

                      • 8. Re: Email a pdf generated from layout in attachment
                        philmodjunk

                        How did you design your layout? (You can upload a screen shot of it captured while it is in layout mode)

                        What options did you specify for your save as PDF step? (Current record? Records Being Browsed?)

                        If you have sub summary layout parts, did you sort your records correctly before saving as PDF?

                        As a test, you might want to add steps that enter preview mode and pause the script just before the save as PDF step. What you see on the screen should be what you'll get as a PDF if you use the Records being browsed option.

                        If that still doesn't work for you, you may need to post the exact script that you have created.

                        To post a script to the forum:

                        1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
                        2. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
                        3. If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
                        4. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
                        • 9. Re: Email a pdf generated from layout in attachment
                          JillX

                          I think I got this problem, I used Go to related record and selected the layout I need based on table Spec.

                          Thank you very much for your thorough explain! I'm still greenhand with FMP, you really helped me a lot with my learning.

                          Thank you again!