I hate it when people do it to me, but I'm going to do it to you, John. I always post some awsome code, and people immediately start asking for enhancements -- instead of letting me bask in the glory of the accomplishment. Sorry. ;)
I've used techniques very similar to this for dealing with flat files, grid controls, etc. I would typically just use <cfoutput> except for when I have to deal with more complicated features like paging, sorting, filtering, and especially grouping. I hate having to rebuild this kind of complicated logic each time. So for these, I've always wanted to use a library that would efficiently handle the harder tasks in a standard way. I think it comes down to this. This discussion has already been down the route of: "why don't you just use <cfoutput>." And there are many good reasons that you might want to build an enhanced iterator control. But, without making the iterator itself TOO big and clumsy, it is good to really differentiate your library by adding features that you just cannot do without a whole lot of effort. Once you confirm that you have a solid working set of code, I believe that it is these extras that will make it worth your time to choose the enhanced (but admittedly slower) library over the base features built in to the language. What I'm suggesting is to build in some way for your query iterator class to be able to traverse queries in more complicated ways than just 1 -> RecordCount. For example, 1) I want to process all items in this query, but I want to specify one or more fields to "group" on, and I want some special alert to be raised if this is the first or last element in the group. Or, 2) I'd like to traverse this query, but only process items that match some criteria I've specified. And, 3) I know that we can re-order tables using query-of-queries, but since we're going to all this trouble to build a query iterator, it would really be nice to include that functionality as well. Or, 4) you could add a MOD 2 calculator that would tell me if I'm on an odd or an even row. Looking at your list of functions to be added, I see that you're already thinking along the same lines, with sorting and filtering features planned for the future. I suggest that you consider adding some additional functions such as these: SetGroupColumn() -- sets the column that the iterator will group on IsGroupBegin() -- true if this record has a different group column than its predecessor IsGroupEnd() -- true is this record has a different group column than its successor IsOddRecord() -- true if this record is odd IsEvenRecord() -- true if this record is even -- Benjamin Pate http://smartcms.tigris.org I have 3 GMail invites for anyone who's interested. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
