Setting A Variable In A False If Script Step

This is a little trick I’ve just learned, and I’d love to know who has been using this trick.

Each If or Else If script step in FileMaker is evaluated to determine whether its true or false. This means that you can define global or local variables in a Let ( ) statement in the very first IF statement, and those variables will be available for the rest of the script, or in the case of a global variable, until FileMaker is closed, or until the variable is given another value.

[Click here to see a movie demonstrating this idea]. Watch the data viewer to see when the variable gets defined:

  1. The variable starts out defined from the previous test
  2. It gets cleared by the first script step
  3. It gets set by the falsely evaluating first If script step
  4. It skips the result of the first If statement, now with the variable $$Test defined as “Hey!”
  5. The value of the variable validates the Else-If step, and fires the “True!” dialog.

This could really help reduce your code load, and the places you have to edit that code later.

This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to Setting A Variable In A False If Script Step

  1. Bruce Robertson says:

    Video does not seem to be available; or perhaps requires Flash?

  2. Bruce Robertson says:

    FYI the movie link doesn’t work from iPhone/iPad. But watched it via iMac, thanks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s