6 Replies Latest reply on May 2, 2006 3:27 AM by BKBK

    Re: Traverse A Nested Struct

    Level 7
      > last struct in a nested struct
      Strictly speakly, that doesn't exist. By default, Coldfusion does not sort the
      keys of a structure. The following code gives a sorted list of keys, some of
      which are themselves structures.

      <cfset employee.name.first = "Mary">
      <cfset employee.name.last = "Smith">
      <cfset employee.position = "Boss">
      <cfset employee.phone.home = "111-2222-33333">
      <cfset employee.phone.office.ext = "444">
      <cfset employee.phone.office.number = "555-6666-77777">
      <!--- list of keys --->
      keys: <cfoutput>#ArrayToList(StructKeyArray(employee))#</cfoutput><br>
      <!--- case-insensitive alphabetical sort of list of keys --->
      keys, sorted: