11 Replies Latest reply on Apr 17, 2017 8:25 AM by rgordon

    Script to process a found set


      Can someone give me pointers for the best way to go about this...


      In a found set I need to send different emails depending on the contents of one field in each record. For example, I have found all members who will expire in May; I then need to send email A to type A members, email B to type B members, etc., for 4 different types. There will also be different attachments for each member type, but perhaps that’s for another day!


      (Or as a learning exercise, rather than sending emails, the script would go to different layouts, that could be printed as letters, depending on the member type - if type A, go to layout A; if type B, to to layout B, etc)


      Thank you.

        • 1. Re: Script to process a found set

          For "members that will expire in May" that are also "type A", will the "type A" email be exactly the same or will the email contain info--such as their name, unique to each member?


          Both options are possible.


          And have you tried using FileMaker to send email before? Even a "test email" sent after selecting "send mail" from File menu would confirm that you are able to use either an email client program or smtp to send out the email.

          • 2. Re: Script to process a found set

            It would be good if emails could be personalised with names, but to be honest, I'm such a newbie I'll go for the easiest option at the moment!


            I haven't used FileMaker to send emails before. Perhaps at this stage I should just get the script to create a letter or PDF, then once that's working, I can look at the email side of things.

            • 3. Re: Script to process a found set

              Unless you attach that letter to the email, the work to create the letter so that it can be printed or saved as PDF might not get you any closer to generating that PDF.


              I suggest that you pull down the File Menu and select Send...|mail to see if you can actually send an email from FileMaker. You may find that this works without any problems or you may have issues to pursue. You may find that using SMTP instead of a local email client is a better option or even an email Plug in.


              The first thing that I would do in developing the script is to perform a find where you specify the expiration criteria and the type so that you first find all expiring Type A members, then all expiring Type B memers and so forth. This will allow you to process all expiration notices for a given type of member as a group.


              Since you are new to this, are you able to set up a script that can do that much?

              • 4. Re: Script to process a found set

                The original search is done manually - so the user will perform a Find for all May's expiries. The script will then sort the found set. What I don't know how to do is to get the script to treat the different types differently, i.e. to recognise that the first 250 records are type A's and so get email A, the next 200 records are type B's and so get email B, etc.


                Should I be approaching this differently - perform a Find for type A's with May expiry & send email A to them; then perform a Find for type B's with May expiry & send email B to them, etc.?


                I'll have a look at sending emails and see which works.


                Thank you for your patience!

                • 5. Re: Script to process a found set

                  Once you have a found set -even if it's not sorted - you have to loop on the found records.


                  Depending on the situation of the record you're on while looping, you decide what to do.


                  I don't see the problem.

                  • 6. Re: Script to process a found set

                    And I am suggesting that you change that find--which also need not be manual.


                    Pulling up one found set for each type of "expired member" can make the resulting scripting easier.

                    • 7. Re: Script to process a found set

                      After finding your records, your script might look something like this

                      • 8. Re: Script to process a found set

                        I eagerly anticipated your example script... but there's nothing there!

                        • 9. Re: Script to process a found set

                          Sorry about that.  I had a screen shot attached to the post.  Not sure what happened.  Here it is again.



                          Edit: vlines:: will be replace by whatever table name you are using

                          • 10. Re: Script to process a found set

                            Thanks; yes, I think I can manage that part. I've still to look at emailing, though. I'm doing this in my spare time, so it's a long slow process - to be fitted round work!

                            • 11. Re: Script to process a found set

                              Here is one example of how you might set up the email. There are multiple ways to do this.  Each type would have their own email step in the loop.


                              1 of 1 people found this helpful