Can't search records in FMP7


tell application "FileMaker Pro"
	name of table 2 -- returns "table name" (obfuscated for privacy)'
	access of table 2 -- returns full
	record 1 of table 2 -- returns list of values of fields {"123","foo","bar"...etc}
	name of field 1 of table 2 -- returns "SKU"
	field 1 of table 2 -- returns list of values of field 1 every record of table {"100","101",... etc}
	record of table 2 whose field 1 contains "100" -- FileMaker Pro got an error: Can't get record of table 2 whose field 1 contains "100".
	cell 1 of table 2 -- returns "100"
	number of cells in table 2 -- returns 109497
	number of fields in table 2 -- returns {}
	number of records in table 2 -- returns 2147
	field 1 of record 1 of table 2 -- returns "100"
	cell 1 of record 1 of table 2 -- returns 100
	every record of table 2 whose cell 1 contains "100" -- FileMaker Pro got an error: Can't get every record of table 2 whose cell 1 contains "100".
	record 1 in table 2 contains "100" -- returns false		
end tell

I need to muck with the data without using or changing the built-in layouts… updating fields within records, but I can’t find the record I need to begin with. None of the sample code I’ve found (including on this forum) works.

I do seem to be accessing the database directly (via the table occurrence I’ve been reading about). But I can’t get to seem the syntax right when it comes to getting a reference to the record and cell I need. I’m sure it’s something small I’m missing…

(per guidlines, my applescript familiarity is: relatively new to applescript, not new to programming/scripting in general)

There are some circumstances where your 2nd try wouldn’t work. If you’re not on a layout of table 2 it won’t work. If there’s a zero found set in table 2 it won’t work. So it seems that to be sure you need to show all the records of table 2 and specify the layout. This works:

show every record of table 2
every record of layout "Sales" whose cell 2 contains "100" 

[There seems to be a weakness regarding the tables and layouts. I can get all the layout names. But I cannot tell which belongs to which table (which are actually the table occurrences in the relationship graph). So it’s not possible to say:
layouts of (name of table 2)
or
name of table of layout “Sales”
I can’t find any way to query the connection between tables and layouts, other than using “current” on each when you’re on it.]