Re: Trouble with simple Find in FMP data base
Re: Trouble with simple Find in FMP data base
- Subject: Re: Trouble with simple Find in FMP data base
- From: Andrew Oliver <email@hidden>
- Date: Fri, 23 Jan 2004 10:09:17 -0800
Your syntax of the 'find' event is completely wrong.
If you look at Filemaker's dictionary, the definition of 'find' is:
find: Perform a FileMaker Pro Find given current requests
find reference -- The window in which to find
In other words, as far as Filemaker Pro is concerned, 'find' invokes the
find command (Command-F) on a specified window. Nowhere in that command do
you have an option to say what you want it to find or which cells you want
to find it in.
With your code, Filemaker is trying to coerce "myValue in cell myCell of
database myTable" into a window reference which is surely never going to
happen.
You therefore need to rework what you're trying to do. If you do need a
vsual find (that is, the found records are displayed in Filemaker, just as
if you'd performed the find manually) you'll need to manipulate Filemaker's
'request' object:
tell application "Filemaker Pro"
set cell myCell of request 1 to myValue
find
end tell
However, if you're just trying to get the records for your own script to
process, you don't need to use 'find' at all (remember, find performs the
find in the current window). Instead you can get the data directly:
tell application "Filemaker Pro"
get every record of database myTable whose cell myCell is myValue
end tell
This code will return a list of database records which you can further
manipulate with AppleScript.
Andrew
:)
On 1/23/04 9:37 AM, "Chap Harrison" <email@hidden> wrote:
>
The following script generates an error on the find statement (FMP is
>
running, LineItems DB is open, and InventoryCode is defined as text).
>
>
-- FMP error: Unable to coerce data to the desired type"
>
>
When I use literals ("T5840", etc) in the find statement, instead of
>
variables, I get a syntax error:
>
>
-- Can't get "T5840" in cell "LineItemsID" of database "LineItems.db5".
>
Access not allowed.
>
>
I need a clue! Anyone?
>
Thanks, Chap
>
>
-- start script
>
set myValue to "00002"
>
set myCell to "InventoryCode"
>
set myTable to "LineItems.fp5"
>
>
tell application "FileMaker Pro"
>
find myValue in cell myCell of database myTable
>
end tell
>
-- end script
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.