Jump to content

Conditional Script Trigger


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

Recommended Posts

Using Filemaker 13 advanced. I have a field (Delta T Set) that contains a dropdown list,  it may only contain certain values based on a value in another field (Rise Over) that's previously been entered. The user clicks on a popover that presents the drop down where they can make choices, I want the script to trigger on modify so that they receive an error message warning if it's not compatible with the type of value in "Rise Over". Right now they are given a warning but they are still able to close the popover or exit the field. I must be missing something... any help would be appreciated. I have the script trigger on objectmodify.

 

Set Error Capture [ On ]

If [ (Photos 1::Rise Over = "ambient" and (Photos 1::Delta T Set = "NETA Component / Component")

or Photos 1::Rise Over = "air" and (Photos 1::Delta T Set = "NETA Component / Component") or

Photos 1::Rise Over = "atmosphere") and (Photos 1::Delta T Set = "NETA Component / Component") ]

Show Custom Dialog [ Title: "Error"; Message: "The Criteria Set you selected does not apply here. Please choose a Criteria Set

that applies to a rise over ambient."; Default Button: “OK”, Commit: “Yes” ]

Go to Object [ Object Name: "Criteria Set" ]

Else

If [ (Photos 1::Rise Over ≠ "ambient" and (Photos 1::Delta T Set = "NETA Component / Air")

or Photos 1::Rise Over ≠ "air" and (Photos 1::Delta T Set = "NETA Component / Air")

or Photos 1::Rise Over ≠ "atmosphere") and (Photos 1::Delta T Set = "NETA Component / Air") ]

Show Custom Dialog [ Title: "Error"; Message: "The Criteria Set you selected does not apply here. Please choose a Criteria

Set that applies to a rise over a component(s)."; Default Button: “OK”, Commit: “Yes” ]

Go to Object [ Object Name: "Criteria Set" ]

End If

End If

Link to comment
Share on other sites

I would suggest you trigger your script OnObjectValidate and structure it along these lines:

If [ ... ]
  Show Custom Dialog [ ... ]
  Exit Script [ Result: False ]
Else If [ ... ]
  Show Custom Dialog [ ... ]
  Exit Script [ Result: False ]
End If

Exiting the script with a False result will cancel the triggering event and leave the user in the field.

 

it would be good practice to also validate the field. The script will only work on the layout/s where it is installed to trigger, while validation works at data level.

 

 

--

P.S. Please use the default font for your questions and use the <> code button to format your code.

Link to comment
Share on other sites

This topic is 2815 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
 Share

×
×
  • Create New...

Important Information

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