• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: can I make a list of records?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can I make a list of records?


  • Subject: Re: can I make a list of records?
  • From: email@hidden
  • Date: Fri, 1 Feb 2002 01:31:11 EST

I'm drowning in digests, so if someone already provided this seemingly simple
and obvious solution to your question ... (but everyone seemed oddly off the
mark, and then the subject devolved into a curious discussion of OOP that I
plan to respond to separately)....

set myFirstRecord to {name:"jack", age:"32"}
set mySecondRecord to {name:"peter", age:"41"}

set listOfRecords to {myFirstRecord, mySecondRecord}

set myThirdRecord to {name:"jeff", age:"40"}

-- I have learned not to use "set" with lists, due to data sharing
copy myThirdRecord to the end of listOfRecords

try
listOfRecords as integer -- deliberately err
on error errmsg
-- show the data structure
display dialog errmsg as Unicode text as string
end try

I use lists of records all the time and build large data structures out of
them. It's a great way build web pages without a "real" database.

Jeff Baumann
email@hidden
www.linkedresources.com



In a message dated 1/28/02 10:56:15 AM, James Sentman wrote:

>Hi Folks,
>
>I'd like to be able to represent some data structures as lists of
>records so that I can do things like
>
>set myFirstRecord to {name:"jack", age:"32"}
>set mySecondRecord to {name:"peter", age:"41"}
>
>and then put them into a single list, but make it a list of records,
>not just a list of strings which is what I always seem to get.
>
>set MyList to MyList & MyFirstRecord & MySecondRecord just gives me a
>regular list of strings with 4 items in it. I need a list of 2
>records so that I could do something like:
>
>set MyRecord to item 2 of MyList
>return name of MyRecord
>
>would then return "peter"
>
>The point is to be able to build this structure in a loop and then
>pass it off to a program in a single step rather than sending lots of
>events over and over which would slow things down too much.
>
>Any help or pointers to further documentation greatly appreciated!
>
>Thanks,
> James


  • Prev by Date: Re: ACGI form parsing in OSX?
  • Next by Date: Re: Can any tell me about error -1701?
  • Previous by thread: Re: Passing Variables (Was: ACGI)
  • Next by thread: Re: Can any tell me about error -1701?
  • Index(es):
    • Date
    • Thread