In this example, we are testing to see if a date and a time are within working hours ( Monday thru Friday ... and ... 8 AM thru 5 PM ). If it is within working hours, we tell the user so. We also throw up a dialog box telling the user that weekends are not work days or that it is not time to go to work.
The nested IF does a check to see if the current time is within working hours. A TRUE result brings us to the nested IF. A FALSE tells us that it’s not working hours. The nested IF sees if the day of the week is greater than 1 ( Sunday ) and less that 7 ( Saturday ). A TRUE tells us that we should be at work. A FALSE tells us that today is not a work day.
The sequential test script basically does the same thing but in an opposite direction. The first thing it does is see if the time is before 8 AM or after 5 PM. A TRUE result tells us that it’s not time to be at work and then executes a Exit script step ... stopping the script right there. If the script isn’t stopped, it performs the second IF in the sequence. This tests to see if the current day is less that 1 ( Sunday ) or greater than 6 ( Friday ). A TRUE result tells us it’s not a work day and then executes a Exit script step ... stopping the script right there. If the script isn’t stopped, it tells us that we should be at work.
You can see a difference between the two methods but the results are the same. In the nested IF, we use a lot of AND operators to look for a TRUE result. In the sequential IF, we use a lot of OR operators and are basically looking for a FALSE result to quit running the script.
An example file can be downloaded by clicking (here)
© 2010 - 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.