Re: Scripting an AppleWorks database
Re: Scripting an AppleWorks database
- Subject: Re: Scripting an AppleWorks database
- From: Jeffrey Mattox <email@hidden>
- Date: Fri, 2 May 2003 00:52:52 -0500
I can use the "unavailable" keyword for a text field, but not for a
number field. If any of the records has an empty value in the number
field, I get an error.
For example, if I do this:
tell application "AppleWorks 6"
tell document "database.cwk"
field kind of field "usage"
--> number field
record 1
--> {|name|:"Jeff", usage:unavailable}
records whose value of field "usage" is less than 5
--> gives a descriptor mismatch error
records whose value of field "usage" is unavailable or (NO BREAK)
value of field "usage" is less than 5
--> gives a descriptor mismatch error
end tell
end tell
1. If any of the number fields is empty, then the whose clause fails.
2. If the whose clause tests for unavailable, the clause always
fails, even if all the number fields have values.
So, how do I get my whose clause to work when a number field is empty?
My objective is to treat empty fields as zero, so I want to get those
records whose "usage" field is empty or less than 5.
Jeff
At 5:10 PM -0400 4/30/03, Deivy Petrescu wrote:
On Wednesday, April 30, 2003, at 04:52 AM, Jeffrey Mattox wrote:
I am just learning how to script an AppleWorks database, and have
run into a problem.
tell application "AppleWorks 6"
every record of document 1 whose value of field "status" is "ready"
end tell
The "status" field is a text field. If every record in the
database has a non-blank value for the "status" field, everything
is fine and I get a list of records. However, if one or more of
the records has an empty status field, the middle line fails with:
AppleWorks 6 got an error: A descriptor type mismatch occurred.
I cannot guarantee that every record is filled in. How do I get a
list of records that match a condition, and skip those where the
field is empty?
Jeff
Jeff, this works:
tell application "AppleWorks 6"
every record of document 1 whose value of field "status" is
not unavailable and value of field "status" is "ready"
end tell
_______________________________________________
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.