8 Replies Latest reply on Oct 6, 2009 6:24 AM by GaryNY

    Sorting an array of structures in CF 7

    GaryNY

      Hi !

      I populated an array of structures from an invoked method- query loop:

      (ind is increased in a loop)

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <CFSET TD[ind] = StructNew()>

       

       

      <cfset TD[ind].V1 = "#qryTermst.v1#">

       

       

       

       

       

      <cfset TD[ind].V2 = "#qryTermst.v2#">

       

       

      <cfset TD[ind].V3 = "#qryTermst.v3#">

      <cfset TD[ind].D = "#DateFormat(qryTermst.date, 'M/D/YYYY')#">

       

       

      <cfset TD[ind].V5 = "#qryTermst.v5#">

       

      It looks fine and contains correct data.

       

      After the array is populated- later - I need to display it in descending order of D (dates) and in ascending order of V1.

      I tried to use the StructSort function, but did not get results in CF 7- strange errors...

       

      Any help will be appreciated !

       

      Regards !