how do you sort a collection search

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default how do you sort a collection search

    I was wondering if there was a way to sort a collection search by the custom1
    field which is an ID number? Do I have to do that programmatically or is there
    a handy attribute that could be used? It would be much easier to sort it when
    the search is done and then loop through the results with a cfoutput, rather
    than sort the results into a new list and then loop through that, but I guess
    it's not too big a deal. Just wondered if there was a shortcut. Thanks, Oak

    oak3 Guest

  2. Similar Questions and Discussions

    1. Databinding to collection classes, how do I sort and set data keys?
      Hi all, I have a two classes Course.cs and Courses.cs. Courses is a collection class of Course objects stored in an ArrayList. My Course object has...
    2. Search PDF collection / indexing puzzle
      Hello all - thanks upfront for so much great information. I've come across a strange problem in both Acrobat 5.0.5 and 6.0.1 for Windows. I have...
    3. search and sort data
      I've got data in a table (fields are page num, part, model, type, price). I'd like a user to enter a part number, for example, and have that record...
    4. Merge sort and binary search
      Hi, I'd just posted 2 articles with sample code, 1 on using merge sort, another on binary search, at http://xtras.calu.us/articles.php . I love to...
    5. search for duplicates and sort array
      Rick L wrote: Whenever someone wants to know if a <something> is a member of a set, then it springs to mind that a hash is desired, not an array....
  3. #2

    Default Re: how do you sort a collection search

    Try using Query of Queries and the 'order by clause:

    <cfquery dbtype="query" name="sortedQuery">
    select *
    FROM OriginalQuery
    ORDER BY custom_1
    </cfquery>


    --
    Tom Jordahl
    Macromedia Server Development


    Tom Jordahl Guest

  4. #3

    Default Re: how do you sort a collection search

    Cool. Is there a way to take 2 collections and merge the results this way or would you do the initial query with an 'AND' operator between the select statements?
    oak3 Guest

  5. #4

    Default Re: how do you sort a collection search

    Since you are not doing a Query, you can search multiple collections at the
    same time if you want by putting a list of collections in the cfsearch tag.

    --
    Tom Jordahl
    Macromedia Server Development


    Tom Jordahl Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139