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: Gary Lists <email@hidden>
- Date: Fri, 23 Jan 2004 13:40:58 -0500
Chap Harrison wrote [1/23/04 12:37 PM]:
>
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"
Because you can't coerce a string and some AS commands into a reference to a
window. Of course.
The 'find' command takes a reference to the window in which to perform the
find. It operates using the then-current Find Requests. You've not
scripted any.
>
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
You must first build up your requests, then populate them, then perform the
find.
do menu menu "View"'s menu item "Find Mode"
-- same as: do menu menu 4's menu item 2
-- except the second will work on any language system
-- or if the user has changed the menu labels
tell dRef to create new request
-- set your field's here to the search values
-- then perform the find
FYI, to match an exact field, then you must (by script) insert the needed
"==" before the string.
Similarly, to match literal values of text (substrings), then you must wrap
the search strings in curly quotes (ASCII 210 and 211).
Also, read the dictionary for FM. It'll help (I think.)
--
Gary
_______________________________________________
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.