Hello Filemaker and Applescript Gurus,
I currently have a script that finds a unique record in a Filmaker database by searching for a unique item code (see below). The script then returns a price value from a field in that record. Is there a way to make this happen behind the scenes? This script has to show the record in order to get the value.
My current script:
tell application "FileMaker Pro"
tell database "Pricing Database"
show (every record whose cell "Item Code" = "XDC-BC2L")
set thePrice to contents of cell "Quantity 500" of current record
I don’t believe so. One method though could be to set all the records to a list inside AppleScript and then do your serching inside AS.
I’m curious why you want to “hide” this operation though.
You may want to try:
tell (every record whose cell "Item Code" = "XDC-BC2L" )
set thePrice to field "Quantity 500"
keep in mind that if more than one record meets the criteria it will return a list of values for “thePrice” with a value for each record returned
James & nedloh99,
Thanks for the fast replies!
nedloh99 your solution works great!
one more question…
The Filemaker database in question is being hosted by a Filemaker Server on another compter. Is there a way to do this without having to open the filemaker database locally?
Let’s throw a question at your question:
How do you do that now without Applescript?
I was always using Applescript…
I just discovered an issue with your solution. In order for your example script to work, the database has to be the frontmost open database in Filemaker. Any thought… ways around?
nest the record tell within the appropriate database tell
Thanks for the reply James… however, this doesn’t fix the problem… I suspect you are on the right track… because it is the “tell” that causes the problem. filemakerbob
You could make the database the active one
tell application "FileMaker Pro Advanced"
go to database "Pricing Database"
tell (every record whose cell "Item Code" = "XDC-BC2L")
set y to field "Quantity 500"
I’m sure there is another way too though FM is pretty flexible.
Thanks James! That worked - filemakerbob