Applescript to find records in table

I have an Filemaker Database with a table called “FactuurSchijven”. De table contains the field “Facuurnummer”. Now, I’m trying to find all the record of my table, where the cell is “Facuurnummer” is equal to “2019-0-266”.

For now, I have the following code:

tell application "FileMaker Pro Advanced"
	tell table "FactuurSchijven"
		show every record
		show (every record whose cell "Factuurnummer" is "12019-0-266")
	end tell
end tell

I always get the error code -1708, the event doesn’t work.

I tried already a lot of things, but none of them worked. Can someone help le?

It’s working fine for me (even without your first « show every record » line).

The latest FMP versions modified the application name, deleting « Advanced ».
please try with tell application “FileMaker Pro” ( zonder Advanced :slight_smile: )

BM

It still doesn’t work. When I delete the advanced, mijn Scripteditor asks me where he can find Filemaker and he puts back the advanced. I’m working with FM version 16.

My big problem, I want to solve is the following: based on some record in the table, I want to make a numbers file. There. are two options I can do:

  1. Search the records in FM and then with AppleScript make the file in numbers and fill in the fields of the records. Searching in FM is no problem, but with AppleScript I get always the whole table with all the records. I use “tell current table” …

  2. The other way is, do the search Applescript en then sort the record I found. But my AppleScript doen’t do the sort.

I have figured it out. The correct code is:

tell application "FileMaker Pro Advanced"
	tell window 1
		go to layout "Factuurschijven"
		show (every record whose cell "Factuurnummer" = "2019-0-266")
		set n to (count records of layout "Factuurschijven")
		display dialog n
	end tell
end tell