From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer
The IF STATEMENT allows you to branch a script into two or more directions based upon a user choice or by evaluating a set of conditions. The IF Statement is one of the main areas that can separate the beginner FileMaker script designers from the intermediate or advanced ones. You can build an almost unlimited level of functionality by using this step. Branching can be done based upon a users choices, users data entry, the environment of the computer / database / network and even password access level.
What an IF Statement does, is test to see if something is TRUE (accurate or correct). If it is, then the it will execute all the script steps between the IF and ELSE steps. If the statement is not TRUE, then it will skip these steps and perform the steps below the ELSE to the END IF statement.
Just like any highway that you are traveling on can split into different directions, so can your FileMaker scripts. This condition is called branching and it is done via what is commonly called a condition ( IF, ELSE AND END IF SCRIPT STEPS).
Take a look at this make believe branched script ...
IF (Today is a Weekday Mon-Fri)
Set a field to a specific value
Go to a specific layout
Print under a set of desired specifications
Set a field to a totally different value
Go to a specific layout (perhaps the original, perhaps not)
IF (Today is a Weekend Day Sat-Sun)
Show Message (Go HOME! It's the Weekend!)
Quit Running The Script
So in this example, the operations will not run on a weekend ( the day of the week being the condition). The script does something on both sides of the branch. That is to say on one side, it runs a set of step for workdays. On the other side of the branch it informs the user why it’s not performing those steps ( Go HOME! It’s the Weekend).
More info about the author and FileMaker in general, contact me at firstname.lastname@example.org.
© 2008 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.