Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4471 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm writing an applescript to automate copying data between two databases of different FM versions (11 & 12). I've run into a snag though, which is that I'm unable to determine through AS whether a given field is writable or not.

To clarify, I have written code (below) to check whether Filemaker reports the field as being writeable, but it seems that it will report that a calculation field (or cell) is writeable even if it isn't. The two cases I found where this is the case (so far) are if "prohibit modification during data entry" is set on the field, and if it's a calculation field.

Are there any workarounds for this?


--check cell can be written

on checkCellWritable(databaseName, tableName, cellName)

try

  tell application id destID

   using terms from application "FileMaker Pro Advanced"

    tell database databaseName

	 tell table tableName

	 

	  set theAccess to (access of cell cellName) as string

	  set theLock to (lock of cell cellName) as string

	  set theProtection to (protection of cell cellName) as string

	 end tell

    end tell

   end using terms from

  end tell

on error theError

  my write_error_log("checkWritable " & databaseName & space & tableName & space & cellName & space & theError)

  return false

end try

set accessFlag to false

set lockFlag to false

set protectionFlag to false

set prevTIDs to text item delimiters of AppleScript

set text item delimiters of AppleScript to "/"

set accessProperties to text items of theAccess

repeat with accessProperty in accessProperties

  if (accessProperty as string) is "write" then set accessFlag to true

end repeat

set protectionProperties to text items of theProtection

repeat with protectionProperty in protectionProperties

  if (protectionProperty as string) is "write" or (protectionProperty as string) is "formulas protected" then

   set protectionFlag to true

  end if

end repeat

if theLock is "unlocked" then set lockFlag to true

set text item delimiters of AppleScript to prevTIDs

return (accessFlag and lockFlag and protectionFlag)

end checkCellWritable

This topic is 4471 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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