FWIW, I have a getAssociated() method on my base business object that DOES allow me to get associated objects (based on a has-many relationship which needs to be described declaratively in XML) with both filter and order by features so if I want to get the products in a category between $10 and $50 or the shipping addresses (but not billing addresses) or to order the articles in a category I can let the database take the strain.
getAssociated(RelationshipName:string:required, Filter:string:optional, OrderBy:string:optional, PropertyNameList:string:optional) I'm not a fan of writing array sort algorithms for stuff that is being pulled from a persistent store (a db) designed to sort things for you. Just my 2c, others may vehemently disagree (or not?) . . . Best Wishes, Peter On 8/20/07 4:33 PM, "Justin Treher" <[EMAIL PROTECTED]> wrote: > 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 > 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