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 a novice at scripting, but so far I've been able to solve most of my problems. Here is a problem, however, that I can't figure out. I have the following simple one-line script that works correctly in browse mode:

Set Field ["Notes", "LastName"]

When I change this script to the following, however, it fails:

Enter Find Mode[]

Set Field ["Notes", "LastName"]

When I run this second script, FileMaker goes to Find Mode and the cursor is in the first field on the layout. It appears that the Set Field script step doesn't run. Does anyone know why this isn't working?

When I created the second script, I received a confusing dialog box asking me whether I want to keep or replace data needed by the script. I don't understand this dialog, but regardless of how I answer it, the second script still fails.

Thanks, Keith Silva

Set Field does work in Find Mode, but you can't reference regular fields. You can only reference constants (be they text or numbers) or global fields. This is because when you're in Find Mode you aren't in any particular record. If you try to reference a field that is specific to a record (unlike a global field) FileMaker doesn't know which data to use.

So, add a global field, which for my example, I'll call gTemp and rewrite your script as follows:

Set Field [ gTemp, Last Name ]

Enter Find Mode []

Set Field [ Notes, gTemp ]

Perform Find []

Now, the other part of your question, about the dialog asking if you want to keep or replace the find criteria, has to do with the fact that you have an Enter Find Mode script step. One of the options for this script step (which it doesn't appear you want to use) is to Restore Find Request. What this means is that you can enter Find mode, set up the search, perform the find and then go into ScriptMaker, open your script, close it and choose to replace the find criteria. If the Enter Find Mode has the Restore option set, when this script step is reached, the find criteria you set up will be restored. This can be useful if you want to build a custom find request that has a portion the same every time, such as finding all approved records within a certain date range. The approved portion stays the same, so you could save that portion of the find criteria and customize the date range portion.

Perform Find also has the option to save find criteria, but with that script you can't customize the find request.

There are other script steps that act like this, such as Sort, Page (or Print) Setup, Inport. Each of them has the option to restore the status of the function as it was before the script was created, or to replace it with the current status after the script has been created.

Chuck

  • Author

Chuck:

Thank you so much for the clear, thorough and timely answer. This was the first time I had to work with Find Mode in a script and I was not understanding the FileMaker help file and the book I'm using. Your answer really put things in perspective and now the help file and my book are a lot clearer! This weekend I'll make the necessary modifications including changing or adding some global fields. I was really stuck, but now I'm confident I can get this script to work. Like someone else on this forum said; I can't wait until I get good at this! Thanks again for your terrific help.

Regards, Keith Silva

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.