Page 1 of 1

Parse the Array

Posted: Sun Mar 15, 2015 4:17 am
by brandcode
I have the bellow array in the photo
I have get the records from MyArray 1
But i can't get the records from MyArray 2
MyArray2 have a random name!!
can anyone point me how i get it?
MyArray 1.png

Re: Parse the Array

Posted: Sun Mar 15, 2015 7:41 am
by magice
look oh "keys" in the LiveCode dictionary :wink:

Re: Parse the Array

Posted: Sun Mar 15, 2015 12:23 pm
by brandcode
magice wrote:look oh "keys" in the LiveCode dictionary :wink:
I have check the dictionary but i don't find anything related to this.
if i put the below code i get only 1 key the first one. <MyArray 1>

Code: Select all

put the keys of myArray1 to pKeys

Re: Parse the Array

Posted: Sun Mar 15, 2015 2:15 pm
by WaltBrown
Try

Code: Select all

put the keys of myArray1 [b]into [/b]pKeys
otherwise post your code so we can see how the arrays are getting built.

Walt

Re: Parse the Array

Posted: Sun Mar 15, 2015 3:00 pm
by magice
brandcode wrote:
magice wrote:look oh "keys" in the LiveCode dictionary :wink:
I have check the dictionary but i don't find anything related to this.
if i put the below code i get only 1 key the first one. <MyArray 1>

Code: Select all

put the keys of myArray1 to pKeys
I am not to sure what got you to this point, and I suspect that there may be an easier way to set up your data than this multi-dimensional array, but Try this line after the one you posted and see what it does.

Code: Select all

do "put the keys of myArray["&pKeys&"] into pKeys2"

Re: Parse the Array

Posted: Sun Mar 15, 2015 10:14 pm
by Newbie4
just for curiosity, try this:

open up the messageBox and type in it: put the keys of myArray1
then type: put the keys of myArray1[myArray2]

You should be able to drill down the dimensions of your array

Then try: put myArray1[NameA]
the: put myArray1[myArray2][NameA]

You should see the data in each element

Explore with more examples by typing in the messageBox
Does this give you some insight?

note: I can't tell if you have spaces (e.g. "myArray 1" vs "myArray1") but you get the idea

Re: Parse the Array

Posted: Sun Mar 15, 2015 10:21 pm
by dunbarx
Hey, Newbie4

Might be time to upgrade your forum name :wink:

Craig Newman

Re: Parse the Array

Posted: Mon Mar 16, 2015 5:22 am
by Newbie4
Thank you for the nice complement but I still have much to learn. I am nowhere in the league with you, Simon and the others. Besides, I would not know where to change my name or what to.

I am just glad to be able to help others learn LiveCode.

Thanks again,
Cyril