dfoliver Posted April 27, 2013 Posted April 27, 2013 I am a newbie to FileMaker and use Pro 12 Adv with Windows Vista and Outlook 2007. I am creating my first DB and have an email function in it. I have tried with no success to create a script that will only send email if the email address field is populated. It seems that the script is not being looked at and the email will not work at all unless the "Button Setup" has been created. I have tried all the suggestions in the forums and other sites with no success. What am I forgetting? Thanks for all your help. Dave
Jim Gill Posted April 28, 2013 Posted April 28, 2013 Dave, Post the script and you will receive more help - It seems that the script is not being looked at and the email will not work at all unless the "Button Setup" has been created. Not sure what you mean by this Jim
dfoliver Posted April 28, 2013 Author Posted April 28, 2013 Dave, Post the script and you will receive more help - Not sure what you mean by this Jim Here it is Jim. Thanks in advance for looking into this. If [isEmpty ( Studios::Studio_eMail )] Omit Record Else Send Mail [send via E-mail Client; To: Studios::Studio_eMail] End If Dave
Jim Gill Posted April 29, 2013 Posted April 29, 2013 You nearly had it - From FMP Help: IsEmpty Purpose Returns True(1) if field is empty, if a related field, related table, relationship, or file is missing, or if some other error occurs; otherwise, returns False(0). So your script should look like this: If [isEmpty ( Studios::Studio_eMail )] = 1 Omit RecordElse Send Mail [send via E-mail Client; To: Studios::Studio_eMail]End If Is there more to your script? This would only work for the current record. If you want to automate this script over multiple records add a loop. Hope this helps! Jim
dfoliver Posted April 29, 2013 Author Posted April 29, 2013 You nearly had it - From FMP Help: IsEmpty Purpose Returns True(1) if field is empty, if a related field, related table, relationship, or file is missing, or if some other error occurs; otherwise, returns False(0). So your script should look like this: If [isEmpty ( Studios::Studio_eMail )] = 1 Omit Record Else Send Mail [send via E-mail Client; To: Studios::Studio_eMail] End If Is there more to your script? This would only work for the current record. If you want to automate this script over multiple records add a loop. Hope this helps! Jim Yes. I am only doing this for the active record (at this time). Wow. Thanks. I had used the "=1", but in all the wrong places! BUT - I can't figure out how to get the "= 1" AFTER the trailing "]". I can't access in-line statement editing. Dave
RodM Posted April 29, 2013 Posted April 29, 2013 If [isEmpty ( file::field )] or Not IsEmpty( field ) maybe technically there some theory, i am not that bright but.... I been using for years...thousands of time, my standard practice, this format.. Have never need tested if 1 or 0
dfoliver Posted April 29, 2013 Author Posted April 29, 2013 If [isEmpty ( file::field )] or Not IsEmpty( field ) maybe technically there some theory, i am not that bright but.... I been using for years...thousands of time, my standard practice, this format.. Have never need tested if 1 or 0 Thank you Rod. I'll give this a shot and respond with my results. Dave
dfoliver Posted April 29, 2013 Author Posted April 29, 2013 Thank you Rod. I'll give this a shot and respond with my results. Dave Thank you Rod. I'll give this a shot and respond with my results. Dave I tried the IsEmpty route with no results. I am launching the script from clicking an embedded picture. The trigger I am using is OnObjectEnter. Would this be correct? Dave
Jim Gill Posted April 29, 2013 Posted April 29, 2013 I've attached a screenshot om my calc dialog box and in this format your script works for me (obviously you need to substitute Table::field).  And you OnObjectEnter trigger should work fine  Jim
dfoliver Posted April 29, 2013 Author Posted April 29, 2013 I've attached a screenshot om my calc dialog box and in this format your script works for me (obviously you need to substitute Table::field). And you OnObjectEnter trigger should work fine Jim ...hmmmm... I am using the same script, but the script trigger is being ignored (or appears to be). Nothing I do in the script is actually being performed. Am I missing something at a more basic level? Dave
Jim Gill Posted April 29, 2013 Posted April 29, 2013 Seems your script trigger is not firing - in layout mode be sure the field with the photo/trigger is brought to the front. You could also set the field up as a Button to perform the script.
dfoliver Posted April 29, 2013 Author Posted April 29, 2013 This is my script that doesn't get triggered (I suppose). Either with or without the "= 1" doesn't work. The field for the actual email address is formatted as TEXT with no special options set. The button I press to trigger the script is an image. <sigh> such a learning curve. Using the actual field as a trigger works the same as the script (or Button setup). Â Dave Â
Rick Whitelaw Posted April 29, 2013 Posted April 29, 2013 The "=1" is completely unnecessary unless you are using GetAsBoolean.
dfoliver Posted April 29, 2013 Author Posted April 29, 2013 The "=1" is completely unnecessary unless you are using GetAsBoolean.  New script. Still does not work however. I've been looking (somewhat feverishly) for a fix. This script only has to work on the current record.  Here's the current non-working script.  Thanks. Dave
doughemi Posted April 30, 2013 Posted April 30, 2013 Since you have Advanced, have you tried stepping through the script with Script Debugger and looking at error messages, and whether another script is being set by a script trigger?
dfoliver Posted April 30, 2013 Author Posted April 30, 2013 Since you have Advanced, have you tried stepping through the script with Script Debugger and looking at error messages, and whether another script is being set by a script trigger?  Thank you Doug.  Yes I did. I've been running it all day long - until just now I had no positive results.  I just ran the debugger with a "fresh pair of eyes" (I went and cut the grass and ate dinner) and lo and behold - the button was running the wrong script! I had written the one I showed in my previous email, but didn't connect it to the email button <sigh>.  Okay then. So I sleep well tonight.  Thanks for the encouragement Doug, Rick, Jim and Rod.  For those who missed the answer I attached it again here for you.  Dave
Recommended Posts
This topic is 4498 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now