April 19, 200421 yr Newbies I'm in need of a little help in translating the AppleScripts I used with FM6 to FM7. In FM6, I used a FileMaker script that looped through the records of a database and performed an AppleScript on each record. This AppleScript would set variables to the data of various fields, and these variables would be used to tell other applications to do something. For example: tell application "FileMaker Pro" tell database "test.fp5" tell current record set myVariable to get data of cell "test data" end tell end tell end tell tell application "Finder" --do something end tell This approach is no longer working for me in FM7. I've tried writing scripts in ScriptMaker that take the new structure of FM7 into account, and these work fine from within ScriptMaker. I can also do something like: tell application "FileMaker Pro" tell window 1 tell current record set myVariable to get data of cell "test data" end tell end tell end tell However, I haven't been able to work out how to get at data from tables other than the current table from WITHIN FileMaker. Any and all tips and suggestions gratefully received. Tom FileMaker Version: 7 Platform: Mac OS X Panther
April 20, 200421 yr set myVariable to get data of cell "test data" of table "test" or tell table "test" tell current record set myVariable to get data of cell "test data" end tell...
April 20, 200421 yr Author Newbies Sorry, all I get using this method is "Object not found (Error -1728)". Tom
April 20, 200421 yr I do it this way set myVariable to cell "test data" of layout "test" you must have a cell "test data" on a layout "test", but on my database, it works fine.
August 13, 200421 yr Newbies I have gotten the "object not found" error several times. So far it has always been because the field I am trying to access is not included in the current layout.
August 13, 200421 yr I have also had more problems with version 7. I tried several experiments; see the attachments. Uncomment whichever script "tell block" you want to try, and comment the active one. There's several ways that work; and a few that don't. SetFieldsonLayouts.zip
August 14, 200421 yr This has been discussed at length on another list. One basic distinction is between using tables vs windows/layouts. If you want to loop through records, do finds, etc. you need to use window and layout references. But with table references, you can do everything wth NO dependence on layouts. A table reference is a reference to the graph. It has NO connection to layouts or windows and therefore any attempt to refer to layouts, windows when using a table reference will fail. Because it has no connection to a window, there is no such thing as a found set or current record. A table does not have to have a layout connected to it. As usual with FM7 table really means table occurrence; you cannot refer to a "real" table by name. So if you want to loop through a set of records using a table reference you must first do something like collect a list of record IDs with a "whose" clause. ID of every record of table "People" whose cell "City" of table "People" = "Seattle" Or use a relationship: ID of every record of table "SalesReps" whose cell "People::City" = "Seattle" Here's an example: tell application "FileMaker Developer" set tableX to a reference to table "ContactsTO" of database "Interface" set FirstName to a reference to cell "FirstName" of tableX set recRef to a reference to (every record of tableX whose FirstName = "Sam") set data cell "LastName" of recRef to "Johnson" -- result: all "Sam" records get Johnson as their last name end tell If you are using window type references you must refer to layouts. tell app "FileMaker Developer" get current record of layout "Data Entry" of window 1 of database "MyDB" get cell "FirstName" of current record of layout "Data Entry" of window 1 of database "MyDB" end tell
Create an account or sign in to comment