Adding items to a record in a list.
Adding items to a record in a list.
- Subject: Adding items to a record in a list.
- From: Robert Smith <email@hidden>
- Date: Fri, 1 Apr 2005 15:29:51 -0500
I have a list of records, say:
set r1 to {name:"B", junk:"ab "}
set r2 to {name:"A"}
set lr to {r1, r2}
I want to add a "c" to the end of every 'junk:' item in the list. But
those records with no junk: need to get one with just a "c" in it. I do
not want to copy the list, only modify it in place. Here is one try:
on addc(j)
try
set junk of j to junk of j & "c"
on error number errnum
set j to j & {junk:"c"} -- < -- What to put here??
end try
end addc
repeat with i in lr
addc(i)
end repeat
get lr
--> {{name:"B", junk:"ab c"}, {name:"A"}}
The first one gets modified, but the second one doesn't. Any ideas?
--
Robert G. Smith
National Center for Biotechnology Information
Bethesda, MD [Contractor]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden