1 Reply Latest reply on Nov 29, 2006 7:52 PM by BG Solutions

    Help with multidimensional prop list...

    BG Solutions
      I need a prop list that I can sort based on two props, for example, let's say I've got the props A, B, C and for each of these there may be props p1, p2, p3 ... I need to sort my list based on the letters first, then the p's ... I want the final data structure to look something like this:

      myList = [#A:[#p1:[data list 1],#p2:[data list 2]],#B:[#p2:[data list 3]],#C:[#p3:[data list 4]]]

      myList starts empty

      I need a function that can add [data list X] given an outer prop (#A, #B, #C or some other letter) and an inner prop (#p1, #p2, #p3, or some other number) and keep the list sorted. Keep in mind that the list starts completely empty so the props may or may not already be in the list.

      I'm not committed to this data structure. If anyone can think of a way to sort information in a list based on two criteria I can probably adjust my code.

      I've worked with multidimensional lists before, but this one is making my head spin.
        • 1. Re: Help with multidimensional prop list...
          BG Solutions Level 1
          Never mind ... I got it.

          It helps to get up and walk away every once in a while. I was trying to do too much on one line. The trick is to copy the inner list into an empty, sorted, temporary list variable, add the [#pX :[data list X]] property pair, then put the temp list back into myList (which is also spec'd as sorted when it is first declared)