Arrays in Rev
janschenkel at yahoo.com
Fri Dec 10 01:15:12 EST 2004
--- Gordon <gwalias-rev at yahoo.com> wrote:
> Dear Revolutionaries
> Can an element of a rev array be another array?
> If not, is there any way to achieve the effect of
> nesting arrays - OR if not, is there some way to
> create new container types (like the structures and
> unions typical in C and Pascal). Basically - how do
> create complex organized containers (objects) to
> my data?
As Xavier pointed out, there are no nested arrays in
Revolution. In addition to his suggestion to use the
"split" and "combine" commands when needed, I'd like
to point at the other two options : crafting array
keys to simulate the behaviour, and using XML trees as
a way to hierarchically store information into nodes.
1. Array keys
Revolution arrays are actually associative arrays,
which means that the keys can be any string, and you
can use separators as much as you like. Example :
put "01/01/2003" into \
put tCustomerData["78,contacts,3,phone"] into \
2. XML trees
If you build your tree correctly, you can get the
content of your data using calls like :
put "data/customers/history/date" into \
put "data/customers/contacts/phone" into \
put revXMLNodeContents(tXMLTree,tNode) into \
For more information about XML and how Rev supports
it, make sure to download the tutorial by Sarah
Reichelt, available from the Runtime Revolution
website at :
Hope this helped,
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
More information about the use-livecode