I’m new to using AppleScript. I’m wanting to find a way to have a script ask Filemaker (6.0 on OS X) perform a find for a specific record against a specific field. I’m trying to do this:
tell application “FileMaker Pro”
– Make sure the source file is open so we can identify the Spiro source information.
open “Macintosh HD:Users:jlk4p:data:IRIS:Source.fp5” with password “master”
set irisSourceDB to a reference to database “Source.fp5”
if (exists irisSourceDB) is false then return
– Get the record information for the source item.
set sourceSearchRequest to create new request in irisSourceDB
set Collection to irisSourceName in sourceSearchRequest
find sourceSearchRequest
– Make sure the spiro slide collection is open so we can process each of the image records.
open “Macintosh HD:Users:jlk4p:Sites:spiro:spiro_slide_view.fp5”
set spiroSlideViewDB to a reference to database “spiro_slide_view.fp5”
if (exists spiroSlideViewDB) is false then return
set spiroSlideViewRecordCount to the count of records of spiroSlideViewDB
end tell
But I get an error about coercing the data type. I’m probably way off since I’m just looking at questions on this forum to learn what I can. Anyone with an idea?
Um, I don’t understand what you are trying to do but if you are trying to open a database, search for every record where the value of cell x is y and then do something with that record then this code works for me and might get you started:
Thanks for the code snippet. That’s exactly what I’m looking for. In my case the search should return only one record.
show the_rec
generates a FileMaker Pro object not found error. I did add a dialog to display the number of records, thinking that the search was not finding a matching record. However, I am getting one record as the result of the search. Then I commented out the line since I don’t care to view the record I just want the data from it. But I get the same error on
set the_values to every cell of the_rec
Is ID in the line
set the_rec to (ID of every record of the_db_ref whose cellValue of cell search_field = search_string) as list
a reserved word representing the primary key for the table?