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.

What is best practice for scripted Imports?

Featured Replies

I have searched the forum and internet and not found an answer to my delima.

I have a solution with a scripted import of a csv file. I do not want import dialog (e.g. mapping), so I have it set to no.  I don't know the name of the file, only that it is a csv file. If I leave the filename out of the import dialogue, the default SHOW filetype in the open file dialog is for a filemaker database. The user needs education to change the SHOW to csv or all. That is undesirable. If I import a correct file once, the next time the script runs in that session, it prompts for a csv file, but if I quit the application and run it again, it goes back to SHOWing  filemaker databases. If I provide a bogus file, e.g. YourFile.csv -- I have to capture errors or I get no file dialog for them to find their file. If they cancel, they get a filemaker dialog I don't control that tells them the user aborted the import, continue or cancel. If they cancel, the script exits and I don't get control. That, too, is undesirable.

What is the best practice for scripted imports so that whether the user complies or cancels, I maintain control of what happens next?

A classic approach here is to use a global container field and use the "insert file" script step to let the user select the file they want to import.  Your script then turns around and uses "export field content" to spit the file back out but renamed to a static known name that you use in the import script step file reference.

As to the cancel: you'd trap for that on the "insert file" script step.

  • Author

Thanks, I understand and like it. However, I have tried about every possible option and cannot get Insert File to prompt for the file. Is there a trick? I've had no special dialog and the one enclosed. I've tried no source and a bogus source and an existing source. I've tried "go to field" and specified my field as a target. I always get error 102.

 

Screen Shot 2020-01-23 at 12.39.59 PM.png

Googling around, I discovered there is a bug in FMP16A -- even though I have FULL ACCESS, I have to give the script FULL ACCESS. Thanks.

  • Author

Frustrated. In a quicky test database, Insert File works fine from a script with Full Access privileges. I put the exact same line into my application and I get error 102. I've tried about everything.

As soon as I give up, I find the solution. The container field has to be on the layout. All is well.

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.