RE: even better coerce to record with usrf
RE: even better coerce to record with usrf
- Subject: RE: even better coerce to record with usrf
- From: Olof Hellman <email@hidden>
- Date: Wed, 12 Dec 2001 17:42:11 -0800
JJ chipped in:
>
Why are you compiling a record? Why not simply declare it?
>
>
set entry_1 to record {+class usrf;:{"status", "unproc"}}
>
set entry_2 to record {+class usrf;:{"lyrics", false}}
>
>
set Entire_Record to entry_1 & entry_2
>
>
-- That's >> {status:"unproc",lyrics:false}
>
which is brilliant!!! This speeds up the cycle by about half by getting
rid of one 'run script' :
to usrf(theList)
return record {+class usrf;:theList }
end usrf
to extract_record_field(theRecord, theField)
run script " on run{r}
return |"& fieldName & "| of r
end " with parameters {theRecord}
end extract_record_field
set usrfRecord to usrf( {serial number", 75757575 })
extract_record_field( usrfRecord, "serial number" )
--> 75757575
Can anyone figure out how to get rid of the other run script?
- Olof