3 Replies Latest reply on Apr 23, 2007 8:14 AM by Xtramania

    Select List Data

    Level 7
      I have a list like this:

      [[#Item1: "1", #Item2: "1", #Item3: "83", #Item4: "1", #Item5: "360x420",
      #Item6: "/image1/image1.jpg", #Item7: "/image2/image2.jpg", #Item9:
      "/image3/image3.jpg", #Item9: "image4/image4.jpg", #Item10: "175,996"],
      [#Item1: "1", #Item2: "1", #Item3: "84", #Item4: "2", #Item5: "100x100 ft",
      #Item6: "image2.jpg", #Item7: "image3.jpg", #Item8: "image4.jpg", #Item9:
      "image5.jpg", #Item10: "150,000"]]

      This list currently has two data "rows" with 10 "fields" each... however,
      the amount of rows could go up to 200 and constantly change... ITEM3 is a
      unique number and never repeats... how can I write a script that will search
      through this entire list and retrieve all the data for one particular "row?"

      For instance, I want to pull up all the data associated with x=ITEM3?

      Thank you for your help in this matter, hopefully I am making sense!

      Bobby


        • 1. Re: Select List Data
          Level 7
          After a bunch of research, trying to find my answer, maybe I am going about
          this the wrong way! Here is what I am trying to do and maybe somebody has a
          better solution.

          I am downloading data from the internet that looks like this:
          item1|item2|item3 and so on. There will be several hundred items that are
          downloaded and each item is seperated by a line break. Currently,
          everything is working fine... downloading the data and then putting it into
          a list like I mentioned in the last message.

          The trick is, if I want to pull up all the list data associated with
          item3=mynumber, how would I do that?

          item3 is a unique number that I can search by.... Should I put the items
          into a text list instead? How would I then search for that value in the
          "third position" and display the entire line of data....

          Hope I have not confused you even more!

          Bobby




          "Bobby Smith" <bobby@bobbysmith.com> wrote in message
          news:f086k0$fup$1@forums.macromedia.com...
          >I have a list like this:
          >
          > [[#Item1: "1", #Item2: "1", #Item3: "83", #Item4: "1", #Item5: "360x420",
          > #Item6: "/image1/image1.jpg", #Item7: "/image2/image2.jpg", #Item9:
          > "/image3/image3.jpg", #Item9: "image4/image4.jpg", #Item10: "175,996"],
          > [#Item1: "1", #Item2: "1", #Item3: "84", #Item4: "2", #Item5: "100x100
          > ft", #Item6: "image2.jpg", #Item7: "image3.jpg", #Item8: "image4.jpg",
          > #Item9: "image5.jpg", #Item10: "150,000"]]
          >
          > This list currently has two data "rows" with 10 "fields" each... however,
          > the amount of rows could go up to 200 and constantly change... ITEM3 is a
          > unique number and never repeats... how can I write a script that will
          > search through this entire list and retrieve all the data for one
          > particular "row?"
          >
          > For instance, I want to pull up all the data associated with x=ITEM3?
          >
          > Thank you for your help in this matter, hopefully I am making sense!
          >
          > Bobby
          >


          • 2. Re: Select List Data
            CopyPixels
            Bobby,

            You make contradictory statements about rows and columns. It is difficult to figure out what you are trying to do.

            You say, "... how can I write a script that will search through this entire list and retrieve all the data for one particular "row?"

            I don't think that is what you meant to say, because to get the data from row three you write: Row3data = TheList[3]

            I think you are asking how to get all the data in Column 3. Which would be:

            Col3Data = []
            repeat with Row in TheList
            Col3Data.add(Row[3])
            end repeat

            Randal.
            • 3. Re: Select List Data
              Xtramania Level 1
              Use property lists with property based on your key field (item3).

              Something like this:
              rows = [:]

              -- Add row with some data and key 83:
              row = [#item1:"Something", #item2:"Something else",#item3:83]

              rows[ symbol("id" & row[#item3]) ] = row

              put rows
              --[ #id83:[#item1:"Something", #item2:"Something else",#item3:83]]

              --To get a row with id 83 use:
              id = 83
              put rows[ symbol("id" & id) ]