Iterating over a set of FMP records with Applescript
Iterating over a set of FMP records with Applescript
- Subject: Iterating over a set of FMP records with Applescript
- From: Chap Harrison <email@hidden>
- Date: Fri, 20 Feb 2004 14:46:32 -0600
I'm trying to write an AS to get a filtered set of records and iterate
thru each one, locating a record in a related database and changing a
cell value there.
The main loop iterates thru a database of Purchases locating errors.
It grabs the cell 'webOrderNumber' from each record and fetches the
related master record from the WebOrders database, and sets a flag in
the master record.
I seem to be having trouble obtaining and using an "iterator" through
the Purchases DB. Any suggestions?
Thanks, Chap
try
tell application "FileMaker Pro"
(* The following just returns a list of values, which isn't what I
want *)
-- set badList to (records of database gLineItemsDB whose cell
"Price" is "*")
(* I want "pointers to records" so I can refer to cell values by cell
name,
but this won't compile *)
repeat with current record in (database gLineItemsDB whose cell
"Price" is "*")
set myOrderNumber to item "OrderNumber" of current record
(* Again, I want to refer to cell by its name *)
set myInvCode to item "InventoryCode" of current record
set myFoo to "<undefined>"
tell application "FileMaker Pro"
(* The following is a silly way to say it: there is only one
record, because OrderNumber is
unique, but I don't know how else to say it *)
set current record to (record 1 of database gWebOrdersDB whose cell
"OrderNumber" is myOrderNumber)
copy cell "Diagnostic" to myDiag
set cell "Diagnostic" of current record to (myDiag & "Inventory
code '" & invCode & "' is not in the Inventory database. ")
set cell "Status" of current record to "Error"
end tell
end repeat
end tell
on error myMsg
display dialog myMsg
end try
_______________________________________________
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.