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.
Thanks,
filemakerbob
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
end tell
end tell
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"
end tell
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
-N
James & nedloh99,
Thanks for the fast replies!
nedloh99 your solution works great!
Thanks,
filemakerbob
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?
Thanks,
filemakerbob
Let’s throw a question at your question:
How do you do that now without Applescript?
-N
I was always using Applescript…
nedloh,
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?
filemakerbob
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"
end tell
end tell
I’m sure there is another way too though FM is pretty flexible.
Thanks James! That worked - filemakerbob