0 Replies Latest reply on Jan 25, 2007 7:17 AM by gmelanson

    Structures in Arrays + sorting

    gmelanson
      Hi,
      i want to do some sorting on a structure where the items will get rearranged like arraysort does, and not give me the a sorted list of keys.

      So I did an array that contains structures. I also wanted to use structures because i wanted to use names instead of numbers for referencing my data.

      so here's my code.


      <CFSET myArray = arrayNew(1)>

      <CFSET myStruct = structNew()>
      <CFSET myStruct.item = "1">
      <CFSET arrayAppend(myArray, myStruct)>

      <CFSET myStruct = structNew()>
      <CFSET myStruct.item = "2">
      <CFSET arrayAppend(myArray, myStruct)>

      <CFSET arraySort( myArray.item, "numeric", "ASC")>


      how can i make this work?