ordering a set of objects

Results 1 to 4 of 4

Thread: ordering a set of objects

  1. #1
    Tobeee Guest

    Default ordering a set of objects

    Hello<BR>I&#039ve created an object for which each instance (object(x)) holds records from a database. I&#039ve then loaded these into a display table. However, I really need them sorted by one of their attributes (value1) before they go in the table . I ... erm ... oh dear, I can&#039t even think straight to say what I&#039ve tried already as it&#039s been a loooong day! ANY IDEAS??

  2. #2
    Steve Cimino Guest

    Default That's what dbs are for

    You should let the sorting happen when you retrieve the records, not when you put them in. It&#039ll save you time, given what solution I&#039m about to give you.<BR><BR>You have your records... now you want to do some sort on them within an array(?). You&#039ll have to look on www.msdn.microsoft.com on sorting algorithims. If you&#039re not an experienced coder, these can give you a headache. For instance, you have the bubble sort, the quick sort, and the shell sort. Not fun stuff to do on a Friday afternoon.<BR><BR>Dump the data in first, then for your report, use GROUP and ORDER to display your data nice and neat.

  3. #3
    Join Date
    Dec 1969

    Default RE: That's what dbs are for

    I remember in my high school CS classes we&#039d devote entire weeks to figuring out quick sort, bubble sort, etc. -- coding a sorting algorithm is best left to CS academics, not necessarily the rest of us. :) Use ORDER BY in your query and you&#039ll be happier.<BR>Ben

  4. #4
    Tobeee Guest

    Default RE: Sorry, I didn't explain!

    I&#039m doing fuzzy search algorithm in ASP, so need to get records from the db, then assign temporary similarity ratings for each attribute against the user&#039s search attributes... for this reason, the similarities are unique for each search, and so I bring each record (satisfying SOME criteria) into an object within ASP, do the comparisons and store the similarity ratings as extra properties of the objects..... therefore, can&#039t order etc at the db retrieval time. Sorry to mislead you!!! I&#039ll check out the microsoft site though - didn&#039t know they had a search algorithm section. THANKS ANYWAY. Later.

Posting Permissions

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