array info request

keith keith at vortex.co.uk
Mon Jul 25 16:15:38 EDT 2005


>>>The internal order in which keys are stored in a custom prop is not
>>>sorted alphabetically

>>Oh boy...

>It's often not so bad. Associative arrays are often addressed by the 
>key name, so sequential order wouldn't affect that one way or 
>another.
>
>If you need sequential access you can use numeric keys.

Ermm... :-)

Okay, in my state of blissful ignorance I had assumed that arrays 
were effectively arranged in a spreadsheet-like manner. The array 
name is the spreadsheet (in this way of thinking), the keys are like 
a set of column headings, and the elements are the bits of data in 
each cell. I hope I'm not too off-target here! <g>
Anyway, an example of data in this layout, assuming it isn't just bonkers:

Record   Title   ISBN   Author   Editor  Comments
1        ABC	 123	Tim	 Tom     Lots of blahblah...
2        House   345    Mick     Mark    Different blahblah...

Can I extract every record number and title in order to search for 
just titles? (I'm imagining that I'd need to know which record ID a 
found item was in to be able to pull the full record.)


The rough idea in my head right now is to store the data in an array 
in a project:

* People read it, showing one record at a time by either clicking 
through sequentially or by searching for specific things. The 
elements from that record are retrieved from the array and put into 
the right fields as each record is shown.

* If someone wants to edit a record a flag is set in its part of the 
array so others can't do the same to that record. When editing is 
done, the different fields are written back to their respective 
elements in the array.

* New records are made by writing new 'lines' in the array. They are 
then available for others to come across as they browse the data 
collection.

In the opinion of those that have tried this sort of thing and/or 
worked with arrays, is this a moderately sensible approach?

the ever-learning k
(who's wife is waiting for a magic solution to the problem. Doh! :-)



More information about the use-livecode mailing list