Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Try the following script as OnObjectExit trigger:

If [ DayOfWeek ( myTable::myDateField ) <> 7 ]

Show Custom Dialog [ Please choose a date that is a Saturday.” , button “OK” ]

Go to Field ( Select/perform; myTable::myDateField ]

Halt Script

End If

This will keep the user in the field until they pick a Saturday date.

If this merely intended as a message, remove the Go to Field (optionally) and Halt Script steps.

Posted

Is there a way to validate a calendar pick...

You colud use this calculation for the validation option of that field:

DayOfWeek ( Self ) = 7

  • Like 1
Posted

Try the following script as OnObjectExit trigger:

If [ DayOfWeek ( myTable::myDateField ) <> 7 ]

Show Custom Dialog [ Please choose a date that is a Saturday.” , button “OK” ]

Go to Field ( Select/perform; myTable::myDateField ]

Halt Script

End If

This will keep the user in the field until they pick a Saturday date.

If this merely intended as a message, remove the Go to Field (optionally) and Halt Script steps.

This will work perfectly, thank you both for your help... mp

Posted

I'm doing something wrong. When I went to create the script I entered the folloiwng:

If [ DayOfWeek ( _TIMECARD::WeekendingDate) <> 7 ]

Show Custom Dialog [ Please choose a date that is a Saturday.” , button “OK” ]

Go to Field ( Select/perform; _TIMECARD::WeekendingDate ]

Halt Script

End If

When I go to save the script it highlights the If portion of the script and returns the message: "The specified table cannot be found". The name of my table is _TIMECARD so I'm confused why Iwould get this message. Any ideas?

Posted

When I go to save the script it highlights the If portion of the script and returns the message: "The specified table cannot be found". The name of my table is _TIMECARD so I'm confused why Iwould get this message. Any ideas?

What does it read in the bar next to “Table:” when you switch to Layout mode? Not the table name is relevant, but the name of the TO the layout is based on. You can also switch to Layout mode, open the Layout Setup dialog and see the TO name next to the popup “Show Records from:”. (This is another example of FMI confusing people by inconsistently mixing “Table” and “Table Occurrence“ within the UI!)

EDIT: Forget all that. What you did was probably copying my example text 1-to-1 into the Specify box for the Custom Dialog. FileMaker complains about a syntax error because there are not enough quotes.

Write this text incl. quotes: "Please choose a date that is a Saturday.”

Put the “OK” into the box labeled ”Default button”.

This should work now. Forget the first two paragraphs.

Posted

Note that:

1. The If clause should end with Exit Script [False], rather than Halt Script - there may be other scripts running. If this is triggered OnObjectExit, the attempt to exit will be aborted, so the script can be shortened to:

If [ DayOfWeek ( YourTable::Datefield ) ≠ 7 ]

Show Custom Dialog [ ... ]

Exit Script [ False ]

End If

2. Running the script is no substitute to validating at data level.

  • Like 1
Posted

EDIT: Forget all that. What you did was probably copying my example text 1-to-1 into the Specify box for the Custom Dialog. FileMaker complains about a syntax error because there are not enough quotes.

Write this text incl. quotes: "Please choose a date that is a Saturday.”

Put the “OK” into the box labeled ”Default button”.

This should work now. Forget the first two paragraphs.

That works BEAUTIFULLY! Many thanks once again... mp :laugh2:

This topic is 4596 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.