Choices, Choices, Choices
Frank Leahy
frank at backtalk.com
Tue Feb 24 12:33:14 EST 2004
On Tuesday, February 24, 2004, at 01:22 PM,
use-revolution-request at lists.runrev.com wrote:
> Date: Tue, 24 Feb 2004 08:09:27 -0500
> From: Thomas McGrath III <3mcgrath at adelphia.net>
> Subject: Re: Choices, Choices, Choices
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <ACE18847-66CA-11D8-A8B8-000A95DA60FA at adelphia.net>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> Frank,
>
> After looking at the code again I see that each Set of info is named
> differently 1_ and 2_... It seems then that I would need to keep
> another array of those keys and which button number they apply to.
>
> Is there another way to do that? Because in an item del situation I
> would refer to item 1 every time regardless of what was in it. instead
> using key(1_ddd) and key(2_ddd) etc all for item 1's which are the main
> names of each set of items. I can see how the repeats would work with
> building the 1&"_ddd" etc. But is there another way to do it with
> arrays?
>
> Thanks
>
> Tom
>
The array names can be anything you want. For example, if you've got
buttons named "A", "B", "C", ..., "AA", "BB", "CC", ... you might use
myArray["A_date"]
myArray["B_date"]
...
myArray["AA_date"]
...
where each array key is a concatenation of the button name (A, B, C,
...) and the data name (date, title, ....). When you want a piece of
data for a particular button you simply concat the button name with the
field name and use that as the array index.
For example:
put the name of me into myName
put myArray[myName & "_date"] into theDate
And of course the reason you want to use a "_" between the button name
and the data name is so it's easy to parse -- item 1 is the button
name, item 2 is the data name -- if you use the keys property to
iterate through all the array keys.
As to how you should name things in your particular situation, you need
to do an analysis of your data needs both on disk and at runtime, and
think through the kinds of loops you'll be doing on each keypress or
other user interaction. Only then will you know the best way to name
items in the array(s) for both storing and retrieving data.
Good luck,
-- Frank
More information about the use-livecode
mailing list