2 Replies Latest reply on Sep 22, 2008 7:46 AM by Newsgroup_User

    Get a property name (not it's value)

    TJW-dev Level 1
      Hi,

      Does anybody know how I can get the property name (not the value) at a given position in a property list?

      I have lists returned by the makeList() funtion of the xmlparser Xtra, and I need to work through the list (which is of unknown length and format). The list is returned as a complex set of nested property lists, and I need to test the name of each property.

      Any ideas?

      Thansk

      Xav
        • 1. Re: Get a property name (not it's value)
          Level 7
          getPropAt()

          Syntax

          list.getPropAt(index)
          getPropAt(list, index)

          Description

          Property list function; for property lists only, identifies the property
          name associated with the position specified by index in the property
          list specified by list. If the specified item isn't in the list, or if
          you use getPropAt() with a linear list, a script error occurs.

          Example

          This statement displays the second property in the given list:

          put Answers.getPropAt(2)
          -- #b
          The result is 20, which is the value associated with #b.

          • 2. Re: Get a property name (not it's value)
            Level 7
            "The result is 20, which is the value associated with #b."

            Copy & Pasted from Director's Help. The last line (quoted above),
            appears to be an error. The result is not 20, it is #b. The example also
            assumes (but does not state) that the list looks something like this

            answers = [#a:5, #b:2, #c:4, #d:2]