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.

Scripted import error message

Featured Replies

Hi,

I created a button that activates a script to automatically import data from a text file. It does not import the entire file, but rather a select line based on another field. So, for example, if the entire text file said:

Num Type

005 Cat

006 Dog

and the "Pet number" field in filemaker said "005" then it would import "Cat" into the "Pet Type" field of a record that contains various info about a family's animals. However, there are cases when the "Pet number" field might say 010, which is not in the text file. When this is the case I would like to create an error message to let the user know that the pet number they entered doesn't exist. But I cannot figure out how to do that - as it is Filemaker doesn't even stay on the same "Family" record - it just goes to a blank, non-existent record and the user must relocate the family they were working on.

Thanks for any help you can provide!

To give a full answer, we'd need to see the whole script, really.

BUT

I think I understand the problem enough to suggest this. My tip would be to use a "New Window" step IMMEDIATELY BEFORE the import. This creates a duplicate of the window you are working in, and its found record(s).

Do the import as usual.

Immediately AFTER the import, add the following code to your script:

IF get(foundcount) = 0

show custom dialog "Nothing in the text file."

END IF

close window

If the import fails, you get a zero found count, which is what has previously forced the user to navigate back to where they started.

However by doing the import in a new window, it doesn't matter if the found count ends up being 0... we close the new window and the user is put back to where they started :)-)

Note that we close the new window whether or not the import is successful, as the user always wants to go back to where they started. We show the dialog only if the import fails.

Hope that helps.

James

  • Author

Hi James,

Thanks very much for your help! It now successfully returns the user to the correct screen but the error message won't display. I wonder if it has something to do with the kind of import I'm doing? I've attached a copy of the script (maybe I should have attached a copy of the actual DB???) But clearly, no worries if you don't feel like figuring this one out - you've already helped a lot.

Andrew

Script.jpg

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.