Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4988 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

In our systems we will often use scripts to trap for incorrect or missing data. Around the office we call these 'loop catches' because we use a loop to trap for the problem. They usually look like this:

Loop

If[isEmpty(VariableData)]

Show Custom Dialog ["Variable Data"; "Variable Data must be specified."]

Go to Field[VariableData]

Pause/Resume Script[indefinitely]

End If

Exit Loop If[not IsEmpty(VariableData)]

End Loop

I'm wonder in folks have a more efficient way of doing this. For technical reasons we do need to do these operations in a script, but I bet there other (perhaps better) ways to do this.

Posted

That looks about right. However if there is a business requirement for the field to contain a value then field level validation can/should also be used. This will manifest itself as an inability for the record to be committed if it fails validation.

I use some field validation, and the loop catch for "modal" data entry into global fields.

Posted

Now that FileMaker 11 gives us the OnObjectValidate trigger, you don't need the loop. Although in this case, OnObjectExit might be a better choice, since if the field starts out blank, and you don't change it, OOV won't trigger whereas OOE will.

If[ IsEmpty( Get ( ActiveFieldContents ) )]

. Show Custom Dialog["Ouch!"]

End If

To keep the user in the field, be sure to put this step at the end:

Exit Script[False]

See this article (be sure to read the comments too):

http://sixfriedrice.com/wp/the-onobjectvalidate-trigger/

This topic is 4988 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.