Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi, I'm looking for a script step (or custom function) that will allow me to check the validation rules associated with a field from within a script... (so I can do something like If (field passes validation check)...

The problem is that when I use the "commit record" step in the script, the user gets presented with the error message defined in the field options settings from within the database manager window and the script pauses for their input (revert or cancel). I'm looking for someway to prevent that message box from popping up and scripting my own procedure (revert the record and show a different dialogue)

I've already looked at this (http://fmforums.com/forum/topic/72788-scripting-field-validation/) but I'm looking for a way to do this purely from within a script (without creating a new TO) and that uses the validation rules set in the database manager.

thanks!

Have you also looked at:

http://fmforums.com/forum/topic/76514-validate-date-time-or-timestamp/page__p__362286#entry362286

  • Author

Have you also looked at:

http://fmforums.com/...286#entry362286

Thanks,

Ok , now I'm coming at this from a different angle...How can I create a script step that searches in the same field (with the same name in each table) in which ever table you're currently in for duplicates using the "!" operator, and then counts the number of records found?

in this example (which uses imaginary functions that don't exist to help me explain) each table has a field named "FIELD_TO_BE_SEARCHED"

I want something like this: Count ( Find ( Get (LayoutTableName) & ::FIELD_TO_BE_SEARCHED) )

thanks!

Don't confuse functions with script steps. To get the results of a find, you must actually perform a find (and lose your current found set in the process - though this can be solved by opening a new window for the find).

You can use the Set Field By Name[] step to avoid hard-coding the field to be searched.

---

Just to make sure we understand the starting point: there is no good solution for this. When Filemaker added the OnObjectValidate trigger, they did not add a IsUnique() function at the same time. As a result, there is no elegant way to predict the result of this type of validation (and perhaps some other types as well).

  • Author

You can use the Set Field By Name[] step to avoid hard-coding the field to be searched.

This is amazing. Seriously, I just did a google search and came up with a ton of amazing articles about this...thanks so much!

There is a very big difference between a reference to a field and the field's name as text.

GetField ( TableICareAbout::FieldICareAbout )
 

looks at the contents of FieldICareAbout, then tries to to find a field so named in order to get its contents. See the Arrow/Target/Bullseye examples in the help.




GetFieldName ( TableICareAbout::FieldICareAbout )
 

returns the name of the referenced field as text, i.e. "TableICareAbout::FieldICareAbout". From this, it should be obvious that:




GetField ( GetFieldName ( TableICareAbout::FieldICareAbout ) ) 




is the same as:




GetField ( "TableICareAbout::FieldICareAbout" ) 




and very different from:




GetField ( TableICareAbout::FieldICareAbout ) 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.