At 09:53 -0500 02/06/2002, Bill Numerick wrote:

>Hey All,
>
>Can I use getAt or getOne to get the value inside of a list that's 
>inside of another list?
>
>Example
>
>[[#name:Bob], [#name:Heather]]
>
>and lets say I wanted to find a name with the value of Heather using 
>getAt/getOne can I do that?  If so how? :)

Try this:

   on FindSubList lMainList, yHandle, sTarget
     repeat with lSubItem in lMainList
       if lSubItem[yHandle] = sTarget then
         return lSubItem
       end if
     end repeat
     return [ #null, "Not found" ]
   END FindSubList

You'd use it like this:

   lFoundList = FindSubList ( [[#name:"Bob"], [#name:"Heather"]], 
#name, "Heather" )

It would return the list containing that name. If the item wasn't 
found you'd get the final #null return instead.

There are variations; for instance if you don't know the property 
handle associated with your variable, or have multiple items in the 
sublist, you can just not pass the handle variable and do a test of 
each item in the sublist.

Does that help, or have I just muddied the waters? ;)

-- 

              Warren Ockrassa | http://www.nightwares.com/
  Director help | Free files | Sample chapters | Freelance | Consulting
        Author | Director 8.5 Shockwave Studio: A Beginner's Guide
                    Published by Osborne/McGraw-Hill
          http://www.osborne.com/indexes/beginners_guides.shtml
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to