2 Replies Latest reply on Apr 28, 2017 10:31 AM by ch0c0halic

    Emailing a set of portal records

    gedkins

      I was wondering if there is a way to collect each row of data in a portal and pour all that into a single email?

        • 1. Re: Emailing a set of portal records
          philmodjunk

          You can attach a pdf, text, excel or other file of data to an email or you can include the portal data in the body of your email.

           

          Option 1. From the context of a layout based on the parent record, The List function can produce a return separated list of a single field in a related table--such as the records shown in a portal. If you have multiple fields in that portal row that you want to include, define a calculation field that combines the data in a single field and use list to list that data.

           

          Option 2. ExecuteSQL is a function that can both extract and (Within the limits of plain text email if using FileMaker's Send Mail script step), format the data from multiple fields of a specified table--which could be the records in your portal.

           

          With either option there's a button to click in the send mail dialog that lets you define the body of an email as a calculation which is one place where you can put either of these two function calls. You can also use set field to assign the results of such a calculation to a field that you then reference in the calculation specified in the send mail dialog. This option would allow you to preview and edit the message before sending as you can show the field first, then use send mail to send the email.

          • 2. Re: Emailing a set of portal records
            ch0c0halic

            There are several ways to accomplish this. It's dependent on what the data is.

             

            If it's a single field, like a calculation combining all the fields you want formatted the way you want them, then use the List(related::field) to get a return delimited list of the Related data.

             

            If you don't want to create the calculation then you can use the gathering method. Pseudo code:

            Go to related record

            Got to record first

            loop

            set var [$line_data ; The same calc you would have created in the first suggestion & return (¶) )

            go to unbent record

            end loop

             

            Similarly you can have a portal on the layout and use the same gathering process but use the portal relationship in the gathering calculation and use next portal row instead of next record.

             

            I prefer the first solution but it's a personal preference and you may want to use one of the other possibilities.