array info request (was: Re: Rant Re Rev Documentation)
Lynch, Jonathan
bnz2 at cdc.gov
Mon Jul 25 12:55:02 EDT 2005
In simplest terms:
In Revolution, an array is a container that holds keys, and each key is
a variable.
An array can be thought of as a box containing a number of smaller
boxes. myArray[1] would be a box named "1" that is contained within the
larger box named "myArray". The inner boxes do not have to be named
numbers. You can also have myArray["mybutt"] or any other valid variable
name.
If you do this:
Put "myButt" into myVariable
Put "way too scrawny" into myArray[myVariable]
Then the words "way too scrawny" will have been put in a key named
"mybutt" inside an array named "myArray"
Arrays reside in memory, but are not saved. (although you can have
global arrays, which stick around after the handler runs, but are not
saved onto disk)
If you want an array to be accessed by multiple users, you would need to
save it as a custom property set.
Custom properties and custom property sets can really be quite confusing
until you get used to them. They use the same type of notation as
arrays. I would suggest reading the docs about custom property sets very
thoroughly, then coming here to ask questions about those things that
are still confusing.
You can create a data stack that stores information in custom property
sets. You can keep that data stack on a shared drive, and allow everyone
to search that custom property set from their computer.
I warn you in advance, there are quite a few pitfalls to be wary of if
you choose this method - but if you get it right, Revolution searches
custom property sets very fast.
-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of keith
Sent: Monday, July 25, 2005 12:00 PM
To: How to use Revolution
Subject: array info request (was: Re: Rant Re Rev Documentation)
Sometime around 25/7/05 (at 01:19 -0400) Thomas McGrath III said:
>I always learn best by example.
Absolutely!
Speaking of learning by example (or any other method, I'm not fussy!
;-) is there anything around that could help me get my head around
arrays? Some kind of simple guide that doesn't start out at too high
a level? Gotta start sometime! :-)
I've made a bit of headway by dissecting and rebuilding a few simple
things from past threads in this list, so I can put the contents of a
set of fields into a line in an array in a card's user property and
then pull specific elements (items?) back out again.
What I'm wondering is whether arrays would be a useful way to store
data which is to be accessed by more than one person across a
network? There're perhaps 30 different fields and popup menus, and
some of the fields will contain a few paragraphs of text each. (Yes,
paragraphs. So returns have to be accepted in the data, in case that
makes any difference.)
I had been experimenting with using a text file on a networked
computer (as suggested here), with the first item on each line
flagging whether it could be edited or not. Editing a record involves
reading the record, parsing the data into fields, making the changes
there, then writing it all back out to the same record again.
I'm hoping to add search abilities, and I wondered if using a data
array might be more efficient... but I'm definitely fairly in the
dark about these structures!
I presume an array is a kind of data structure that has to be stored
in a stack in some way, perhaps as a user property? It seems to be
layered in a more complex dimensional way than can be represented in
a flat text file. Or am I assuming more complications than there
actually are?
k
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list