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.

Data is being accessed by another...

Featured Replies

  • Newbies

I wrote a quick applescript to upload an image to a server and then insert it into a container in a new record. I'm sure this has been done a million times by other developers, but I couldn't find an existing script.

The problem is that I get an error message:

filemaker got an error: Data is being accessed by another user, script, or transaction

Unknown Error -10011

The error stops showing up for a while if I swivel my office chair around quickly and then scratch my head, then execute the script. Is there a good way to take the voodoo out of this?

Thanks!

Matt

Applescript:

property filepath  ""

property filename : ""

property imagenumber : ""

property serverpath : ""



set oldDelimiters to AppleScript's text item delimiters -- always preserve original delimiters

set AppleScript's text item delimiters to {":"}



tell application "FileMaker Pro Advanced"

	set serverpath to cell "G_serverpath" of current record

	set imagenumber to cell "key Primary Photo" of current record

	tell application "Finder"

		set filepath to choose file with prompt "Choose a file to import:"

		duplicate file filepath to serverpath

		set filename to last text item of (filepath as text)

		set the name of file (serverpath & filename) to imagenumber & "_" & filename

	end tell

	set cell "File Name" of current record to filename as text

end tell



set AppleScript's text item delimiters to oldDelimiters -- always restore original delimiters

  • Author
  • Newbies

I ran the script from Script Editor and found that the error occurs on this line:

set cell "File Name" of current record to filename as text

The "File Name" field is in the active layout and has no restrictions.

The voodoo is that you may have had your cursor in a field when you ran the script. AppleScript is considered another user, so is blocked from editing the record which you left open. It's a good idea to put a Commit Record script step before running Perform AppleScript steps.

If you set a field during the AppleScript, then put another Commit Record step after. Or use the AppleScript FileMaker command "save record," which does the same thing from AppleScript.

  • Author
  • Newbies

Fenton:

Your suggestion worked! Thanks much.

What will we do without voodoo?

Matt

  • 12 years later...
  • Newbies

Just wanted to let you know, a random person in Japan was helped by the "save record" suggestion 12 years after this discussion! Cheers and thanks!

clap2.gif

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.