I'm doing the OOP thing with the help of many tutorials from all over.

I've run into a stump. I'm returning arrays of objects and using those
arrays to populate tables and forms. My object is composed of another
subject (member class has a membershipType class).

I'm trying to figure out how to sort my array of objects by any of the
instance properties (using the getters). Since I'm using a composed object,
sorting directly from the database is out of the question.

I'm guessing it will go something like this:
unsortedArray = application.memberService.getMembers()
sortedArray = arrayNew(1)

//loop through unsorted array 
Loop from=1 to=arrayLen(unsortedArray) index=x
  //nested loop through sorted array 
  Loop from=1 to=arrayLen(sortedArray) length index xx
  //compare strings, if true i.e. string 1 (sorted) is greater (further up
the alphabet), insert at current 
  If
(stringcompare(sortedarray[xx].getFirstName(),unsortedArray[x].getFirstName(
))
    arrayInsertAt(sortedArray,xx,unsortedArray[x])


That's the basic of what I'm trying to accomplish, but I'm sure there must
be a CFC out there for this type of sorting. I'd also like to have multiple
column sorts like the order bys from the database.

Thanks!

        
    
        






You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/cfcdev@cfczone.org

Reply via email to