Rebuild an index in FileMaker?

I’ve written several AppleScripts that work with Filemaker databases. The scripts usually involve searching database files for records and if not found will insert records into multiple tables.

I’ve noticed that sometimes, I have to perform a search manually in FileMaker and then select show all to get my script to work properly. Otherwise the script search seems to find a match to the first record in the database.

I’m guessing that somehow when I manually perform the search, that Filemaker refreshes the index on the [primary key] search field.

Is there a way that I can have AppleScript tell FileMaker to re-index fields? I’m thinking this would make sure that the search that would follow it would always work accurately.

Thanks,
Jack

If you use 'tell document myDoc" your search will be performed on the current records.
You must use ‘tell database myDoc’ to make a search on all records.

If the above dont help, post one of your script here, and tell us what versions of Mac OS and FM you run.

:wink:

I am using “tell database…” as you mentioned. Here’s a snippet of the script…

	tell application "FileMaker Pro"
		tell database irisWorks
			set cell "Work No." of request 1 to workNumber
			find window 1
			if (exists (cellValue of cell "Work No." of current record)) then

Sorry I don’t include the entire script but it is very long and includes several user-defined functions, one of which includes that code above.

I’m developing on OS 10.3.4 with Filemaker 6.x and the test box I’m running it on is OS 10.2.8 with Filemaker 6.x. I’m hoping that my script will run on any OS X system.

Any other suggestions?

Thanks,
Jack

Hello, jackinva

Are you attempting to make a search/request in you database?

This peace of code will do it better.

tell application "FileMaker Pro"
	tell database 1
		show records
		show (records where cell someCell = someValue)
	end tell
end tell

And if you want to make a search within the result of the fisrt request:

tell application "FileMaker Pro"
	tell document 1
		show (records where cell someCell = someValue)
	end tell
end tell

Cheers.

NB: Your previous post does not tell so much on your script. Please, post some more lines if the above does not help.

ionah,
I’ve been unable to execute an AS find command running my AS internally from a FM script using the method of creating requests.

“Show” works perfectly. Thanks you!

LunkerRoo