P.S Here is the query. Not sure if there is a better way to write it to get the desired effect. I removed the InitCount query since is will not help my cause and cannot nest it within my other query driven output. The whole problem lies in not being able to get the currentrow and recordcount of just the categories (27) and do not think this will work with all the records being pulled from this one query.
<!---FUNCTION: GET ALL MAIN AND SUB CATEGORIES---> <CFFUNCTION name="InitAllMainSubCats" access="public" returntype="query" output="no" hint="Retreive all main and sub categories"> <CFARGUMENT name="catStatus" type="numeric" required="yes"> <CFSET var AllMainSubCatsRet = ""> <CFQUERY datasource="#application.DB#" name="AllMainSubCatsRet" username="#application.un#" password="#application.pw#"> SELECT sc.scategoryID, sc.categoryID, sc.subCategoryName, c.categoryName, c.catstatus, c.categoryImage FROM dbo.CLSFD_CategoriesSub_1 sc INNER JOIN dbo.CLSFD_Categories c ON sc.categoryID = c.categoryID WHERE c.catstatus = <CFQUERYPARAM cfsqltype="cf_sql_bit" value="#ARGUMENTS.catStatus#"> ORDER BY c.categoryID ASC </CFQUERY> <CFRETURN AllMainSubCatsRet> </CFFUNCTION> Doug B. ----- Original Message ----- From: "Doug Brown" <[EMAIL PROTECTED]> To: "CF-Talk" <[email protected]> Sent: Friday, January 05, 2007 9:53 PM Subject: Help with column output > I am trying to output the following into 3 columns, the query returns a list of categories and their corresponding sub-categories. There is 27 categories in the list and like 400 subs. I cannot seem to get it. I appreciate the help!! > > > <!---GET ALL CATEGORIES AND THEIR CORRESPONDING SUB-CATEGORIES---> > > <CFINVOKE > component="totallyclassified.components.commonQrys" > method="InitAllMainSubCats" > returnvariable="AllMainSubCatsRet"> > <CFINVOKEARGUMENT name="catStatus" value="1"/> > </CFINVOKE> > > <!---GET A COUNT OF ALL CATEGORIES---> > > <CFINVOKE > component="totallyclassified.components.commonQrys" > method="InitCount" > returnvariable="records"> > <CENTER> > <TABLE border="0" cellpadding="2" CELLPSACING="2" width="980" style="border: 1px solid ##ccccee;"> > <CFOUTPUT query = "AllMainSubCatsRet" group="categoryID"> > <!--- Determine if this is record 1, 4, 7, etc...---> > <!--- If so, open the row. ---> > <CFIF records.currentrow mod 3 is 1> > <TR> > </CFIF> > <TD width="33%"> > <TABLE border="0" cellpadding="2" CELLPSACING="2" cols="2" width="98%"> > <TR> > <TD colspan="2" class="sgrayfont" bgcolor="#APPLICATION.SILVERTABLE2#"><A href="##">#Trim(CategoryName)#</A></TD> > </TR> > <TR valign="TOP"> > <TD width="45%" valign="BOTTOM" height="21" class="sgrayfont"><A href="##"> > <CFIF CategoryImage eq "0"> > <IMG src="images/default-mcat.gif" border="0"> > <CFELSE> > <IMG src="images/#Trim(CategoryImage)#" border="0"> > </CFIF> > </A></TD> > <TD width="55%" class="bblackfont"> </TD> > </TR> > </TABLE> > </CENTER></TD> > <!--- Determine if this is record 3, 6, 9, etc... ---> > <!--- If so, close the row. ---> > <CFIF records.currentRow mod 3 IS 0> > </TR> > > </CFIF> > </CFOUTPUT> > <!--- If the query record count is not equally divisible by 3, ---> > <!--- the last row was not close. ---> > <!--- Determine how many more columns are needed, create them ---> > <!--- and close the row. ---> > <CFIF records.recordCount mod 3 is not 0> > <CFSET ColsLeft = 3 - (records.recordCount MOD 3)> > <CFLOOP index = "i" from="1" to="#ColsLeft#"> > <TD> </TD> > </CFLOOP> > </TR> > > </CFIF> > </TABLE> > </CENTER> > <!--- END TEMPLATE ---> > > > Doug B. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265914 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

