Array problem

Yves Coppé yvescoppe at skynet.be
Sun Jul 7 15:52:01 EDT 2002


>Yves,
>
>I assumed that the cPoints array was already filled with data inside the
>same handler before it entered my code. If you have an array like:
>
>cPoints["Ken"] = 5
>cPoints["Yves"] = 7
>
>and then go into the code, "e" will contain 7 or 5 depending on which loop
>it goes through. The keys(cPoints) will return:
>
>Ken
>Yves
>
>So you see, when you run it through my code:
>
>put "" into myList
>put 1 into elementNum
>repeat for each element e in cPoints
>   if e >= 5 then
>     put line elementNum of keys(cPoints) & cr after myList
>   end if
>   add 1 to elementNum
>end repeat
>
>The first time through the loop, "e" will be 5, and will put line 1 of
>keys(cPoints) ("Ken") & cr after myList.
>The second time through the loop, "e" will b 7, and will put line 2 of
>keys(cPoints) ("Yves") & cr after myList.
>
>Also, I don't know how "the customProperties" will work; I think you meant
>"customKeys". The problem is that the customKeys brings back the name of the
>keys themselves given an object descriptor; that is, in my example, it would
>return "Ken" and "Yves" in a return-delimited list. If you then try to get
>the keys of "Ken" or "Yves", you should get nothing coming back.
>
>I hope I'm being clear. My code above only retrieves the names ("Ken",
>"Yves") and not their scores to do that, amend it as follows:
>
>put "" into myList
>put 1 into elementNum
>repeat for each element e in cPoints
>   if e >= 5 then
>     put line elementNum of keys(cPoints) & "," & e & cr after myList
>   end if
>   add 1 to elementNum
>end repeat
>
>Hope this helps,



You've been very clear and I understand now what I do.
Thank you very much because I can use your code and also adapt it for 
other searchs, now I understand the process.

Cheers.
-- 
Greetings.

Yves COPPE

Email : yvescoppe at skynet.be



More information about the use-livecode mailing list