Filemaker record updating not working for me

Folks,

I’ve only been working with Applescript for two weeks (and FileMaker for about a month) and gotten some help from these forums. I’m at a point where I’m stuck. I’m reading from one FileMaker (which is working fine from the event log debugging) and trying to update records in another FileMaker database. Both files are opened as references. The loop I’m using looks like this:

	repeat with i from 1 to 3
		-- Get the Spiro values to use to populate the IRIS system
		set spiroCurrentRecord to (a reference to record i of layout 0 of spiroSlideViewDB)
		
		-- Go get an IRIS record and update it
		set irisSurrogateRecordNumber to irisSurrogateStart + i - 1
		set irisSurrogateRecord to (a reference to record (irisSurrogateRecordNumber) of layout 0 of irisSurrogateDB)
		
		-- Map the data
		set digitalFileName to cellValue of cell "imageID" of spiroCurrentRecord
		set cell "View Description" of irisSurrogateRecord to cellValue of cell "viewDet" of spiroCurrentRecord as text
		set cell "View Type" of irisSurrogateRecord to cellValue of cell "viewDesc" of spiroCurrentRecord as text
		-- NOTE: picDate does not contain  valid data
		set cell "View Date" of irisSurrogateRecord to cellValue of cell "picDate" of spiroCurrentRecord as text
		-- Format the color Spiro metadata to the required value in IRIS before setting the record value.
		set imageColor to cellValue of cell "color" of spiroCurrentRecord
		if (imageColor = "c") or (imageColor = "c ") then
			set imageColor to "color"
		else if (imageColor = "b") or (imageColor = "b ") then
			set imageColor to "b/w"
		else
			set imageColor to ""
		end if
		set cell "Color" of irisSurrogateRecord to imageColor as text
		-- Format the orientation Spiro metadata to the required value in IRIS before setting the record value.
		set orientation to cellValue of cell "orient" of spiroCurrentRecord
		if (orientation = "l") or (orientation = "l ") then
			set orientation to "horizontal"
		else if (orientation = "p") or (orientation = "p ") then
			set orientation to "vertical"
		else
			set orientation to ""
		end if
		set cell "Orientation" of irisSurrogateRecord to orientation as text
		--save irisSurrogateRecord
		display dialog irisCollection & " record " & i & "  (" & digitalFileName & ") has updated Surrogate record " & irisSurrogateRecordNumber & "."
	end repeat

I’ve tried doing the set statements as “set cell” and “set cellValue of cell”. Neither works. I tried using the commented out “save …Record” thinking I needed to do that. I don’t get any error, I just don’t see the new values appearing in the records. Can anyone tell me what I’m doing wrong?

Maybe it is FileMaker related?

The FileMaker things to mention are that the database I’m writing to was purchased. It requires a password when opening it. Does anyone know if FileMaker would require a password to update records via AppleScript? I tried adding a “with password …” to the set statements or save statement but I get a syntax error.

Also does FileMaker allow you to disable updating records via AppleScript calls to the application? I’m wondering if that’s why the records aren’t updating (if the syntax above is correct).

Thanks,
Jack

Access to FileMaker databases can be limited/crippled at various levels when password protected. I would suggest that you investigate this, by checking the documentation or asking the developer of the purchased database, before proceeding with your script. It might save a lot of time and lower your stress level. :wink:

The purchased application has a process that creates the records. After they are created, I’m trying to automate a way of “importing” data into related tables. So updating is all I’m doing right now. (I’ll worry about creating new records when I need that.)

I will say that I decided to create a new FM database with empty records in it to see if my code actually works since nobody answered that question. It does. I can see the records are updated after running the script against a table with plain text fields. Now I need to identify the differences and see if I can recreate the problem with the actual database that I want to update.