ISO FileMaker Magazine: FileMaker Video Tutorials, Templates, Help & More

FileMaker Deals

Video Browser

Scriptology Video Browser

Tools & Resources

Understanding If

Posted by: MaxR / Wednesday, May 16, 2007 – 5:43pm

I was performing a number script steps like:

If (Contact_Phone) // perform when Contact Phone is present
do
do
do
End If

If (Contact_Email) // perform when Contact Email is present
do
do
do
do
End If

Normally in this scenario I would use If not IsEmpty(Contact-Phone) but was too lazy to type.

The If (Contact_Phone) performs the same as for an If not IsEmpty(Contact-Phone) but not for the likes of If (Contact_Email).

Both Contact_Phone and Contact_Email are text fields (no calcs, validation or the like)

I ran some tests and found that if the content of the field had numeric chars anywhere within it, I'd get the right result but not when the field contained only non numeric characters.

---- How Come? ----

The test for an If() statement must result in a boolean, where zero is false and a value greater or less than zero is true.

Text fields get evaluated as a number for a boolean result, thus the phone number results in a non-zero number and the email address with no numerals results in 'not true'.

-------
Max Rogalsky
Melbourne, Australia
www.maxiwyse.com.au

Filed under:
-