Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: resetting record values to ""
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resetting record values to ""



regarding Paul's "there's no easy way to do it" answer, Bryan said:

>I was afraid of that, Unfortunately the the empty record is:

>property record_out : ** expletive deleted **

>And I have to reset it multiple times in the same script.
>I was hoping for something like:

>set every value of record record_out to ""

>But I may have to just use a handler.


Bryan: maybe I'm missing something but I don't see why you are bothering
reset properties of a record at all. Why not make the record defined in
record_out the result of a handler (kinda like a constructor function)
and set the value of your target record to the result of that handler?

Something like:

property Current_Record : {}

on run
TestMe()
end run

on TestMe()
set Current_Record to NewRecord()
set theRec to Current_Record
set {theRec's Findings, theRec's Impression} to {"deceased", "bugger"}
ResetRecord(a reference to Current_Record) --a reference to theRec)
Current_Record
end TestMe

on NewRecord()
return {Findings:"", Impression:""}
end NewRecord

on ResetRecord(theRef)
set theRef's contents to NewRecord()
end ResetRecord

Note that to set the referenced record it must be a top-level property or
global otherwise it will not be visible to the ResetRecord handler.

R23




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.