4 Replies Latest reply on Aug 5, 2009 2:20 PM by Sean_Wilson

    Multiple Property Lists


      Hello - I would like to create multiple property lists in lingo and then fill those lists with items.  For example


      repeat with i = 1 to 7

           pList(i) = somestring

      end repeat


      I would like to be able to distinguish between the multiple property lists ie pList(1), pList(2) etc.  I've also tried to append a number to the list name, but that always throws an error as well:


      repeat with i = 1 to 7

           pList&i = somestring

      end repeat



      any way I can do that?


      Mike M


      Director 11 on Windows Vista

        • 1. Re: Multiple Property Lists
          Chunick Level 3

          One of the conventional methods that would work quite nicely here is to create a single, global list to which you can add lists. Here's what the structure would look like:


          global gMyList

          gMyList = [ [1, 32, 4, 21], [3, 145, 53, 122], [56, 4, 90, 13] ]



          here's how you might add a newly created list to this global list


          newList = [7, 17, 11, 87]


          • 2. Re: Multiple Property Lists
            mikem75 Level 1

            Thanks for that!  But not quite what I'm looking for.  Let me try to be clearer.  Its really the name of the lists I'm having trouble with.  Ideally I'd like to create 7 lists - pList1, pList2, pList3, pList4 etc.


            Any ideas how to do that?


            Mike M

            • 3. Re: Multiple Property Lists
              Chunick Level 3



              During authoring.


              For example:


              pList1 = []

              pList2 = []

              pList3 = []


              pList7 = []

              Are you looking for a way to dynamically create a variable during runtime that will hold a list as it's value?

              • 4. Re: Multiple Property Lists
                Sean_Wilson Adobe Community Professional

                When someone asks how to do what you are trying, there is always a better way to do it and a very good reason not to do it the way you are trying to. However, you don't go into any detail as to why you think what you are trying to do is important, so it's impossible to provide alternative suggestions. You talk about property lists but seem to be using linear lists. I would suggest using a property list where the property names are generated at runtime:

                on mCreateLists
                  aPropList = [:]
                  repeat with i = 1 to 5
                    aPropList["list" & i] = i
                  end repeat
                  return aPropList

                For the sake of completeness, here's how to do the same in the global space

                on mCreateLists
                  repeat with i = 1 to 5
                    sName = symbol("list" & i)
                    (the globals)[sName] = i
                  end repeat