yeh i can output it to 3 columns but it is when i try to group by studio & try to display the studio name before the columns is when i run into the problems
then it just out puts all the info grouped, like i want, but duplicated into the 2 additional columns not dividing the data... hard to explain i guess. -paul -----Original Message----- From: Craig Dudley [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 12:11 PM To: CF-Community Subject: RE: Group & Loop Help! Ok, I see what your trying to get now, you have the data you require and are just trying to output it into 3 cols, yes? Try this..... just change ColCount to whatever you need <cfset ColCount = 5> <cfset ColsLeft = ColCount - (Employees.recordcount MOD ColCount)> <table border="1"> <cfoutput query="Employees"> <cfif Employees.CurrentRow MOD ColCount eq 1><tr></cfif> <td>Your Employee output in here</td> <cfif Employees.CurrentRow MOD ColCount eq 0></tr></cfif> </cfoutput> <cfif ColsLeft gt 0 and ColsLeft lt ColCount> <cfloop from="1" to="#colsleft#" index="i"> <td> </td> </cfloop> </tr> </cfif> </table> -----Original Message----- From: Paul Ihrig [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 3:40 PM To: CF-Community Subject: RE: Group & Loop Help! Craig I tried that, but couldn't figure it out. now in the code below, it not groups by studio then the employees into 3 columns... But, it list all the studios & employees in each column. instead of dividing the results into 3! i know this should be relatively easy to accomplish once i see a good example of it. would actually make a great server behavior in dwmx -paul <cfquery name="Employees" datasource="RPH" dbtype="ODBC" debug> SELECT DISTINCT tblStudio.StudioName, Left(tblEmployee.Lastname ,10) + ' ' + tblEmployee.Firstname as Fullname, tblEmployee.EMPLOYEE_ID, tblEmployee.EmployeeID, tblEmployee.StudioID, tblEmployee.StatusID, tblStudio.StudioID, tblStudio.OfficeID, tblOffice.OfficeID, tblOffice.City, tblPhone.PhoneNumb, tblPhone.PhoneTypeID, tblFloor.floor FROM tblEmployee, tblStudio, tblOffice, tblPhone, tblFloor WHERE tblEmployee.studioid = tblStudio.studioid AND tblOffice.OfficeID = '5' AND tblStudio.OfficeID = '5' AND tblPhone.EmpResID = tblEmployee.EmployeeID AND tblPhone.PhoneTypeID = '1' <!--- AND tblEmployee.StudioID in (#FORM.StudioID#) ---> AND tblEmployee.FloorID = tblFloor.floorid ORDER BY StudioName, Fullname; </cfquery> <!--- Get the number records returned ---> <cfset count_rows = Employees.recordcount> <cfset NumberOFColumns = 3> <cfset Row_start = 1> <cfset DivCol = (#count_rows# / #NumberOFColumns#)> <cfset Row_End = #NumberFormat(DivCol, "9999")#> <cfoutput>#count_rows# / #NumberOFColumns# = #NumberFormat(DivCol, "9999")# row end #Row_End#</cfoutput><br> <cfparam name="curSect" default="thefirm"> <html> <head> <title>NBBJ Intranet / The Firm / People / Phone List</title> <script language='javascript' src='/include/js.js' type='text/javascript'></script> <cfoutput> <script language='javascript' src='/include/layers_#curSect#.js' type='text/javascript'></script> </cfoutput> <link href="/include/ie.css" rel="stylesheet" type="text/css"> </head> <body bgcolor='#ffffff' topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'> <table width="630" border="0" cellpadding="0" cellspacing="0"> <tr valign="top" align="left" bgcolor="#CCCCCC"> <td width="100" align="left" nowrap>Name</td> <td width="10" align="left" nowrap> </td> <td width="10" align="left" nowrap>Flr</td> <td width="10" align="left" nowrap> </td> <td width="80" align="left" nowrap>Number</td> <td width="100" align="left" nowrap>Name</td> <td width="10" align="left" nowrap> </td> <td width="10" align="left" nowrap>Flr</td> <td width="10" align="left" nowrap> </td> <td width="80" align="left" nowrap>Number</td> <td width="100" align="left" nowrap>Name</td> <td width="10" align="left" nowrap> </td> <td width="10" align="left" nowrap>Flr</td> <td width="10" align="left" nowrap> </td> <td width="80" align="left" nowrap>Number</td> </tr> <TR ALIGN="left" VALIGN="top"> <cfloop index="LoopNumber" from="1" to="#NumberOFColumns#"> <td colspan="5" valign="top" nowrap> <cfif LoopNumber eq NumberOfColumns> <!--- Query of a Query, ---> <!--- <cfquery name="SelectStudio" dbtype="query"> SELECT StudioName, City FROM Employees WHERE StudioName = #Employees.StudioName#</cfquery> ---> <cfloop query="Employees" startrow="#row_start#" endrow="#count_rows#"> <table width="210" border="0" cellspacing="0" cellpadding="0" class="small"> <cfoutput query="Employees" group="StudioName"> <tr><td colspan="15">#City# -#Trim(StudioName)# <cfoutput group="Fullname"> <tr align="left" valign="top"> <td width="100" align="left" nowraps class="small">#Fullname#</td> <td width="10" align="left" nowrap class="small"> </td> <td width="10" align="left" nowrap class="small">#Left(floor,2)#</td> <td width="10" align="left" nowrap class="small"> </td> <td width="80" align="left" nowrap class="small">#Trim(PhoneNumb)#</td> </tr></cfoutput> </td></tr></cfoutput> </table> </cfloop> <cfelse> <cfloop query="Employees" startrow="#row_start#" endrow="#row_end#"> <table width="210" border="0" cellspacing="0" cellpadding="0" class="small"> <cfoutput query="Employees" group="StudioName"> <tr><td colspan="15">#City# -#Trim(StudioName)# <cfoutput group="Fullname"> <tr align="left" valign="top"> <td width="100" align="left" nowraps class="small">#Fullname#</td> <td width="10" align="left" nowrap class="small"> </td> <td width="10" align="left" nowrap class="small">#Left(floor,2)#</td> <td width="10" align="left" nowrap class="small"> </td> <td width="80" align="left" nowrap class="small">#Trim(PhoneNumb)#</td> </tr></cfoutput> </td></tr></cfoutput> </table> </cfloop> <cfset row_start = row_start + #NumberFormat(DivCol, "9999")#> <cfset row_end = row_end + #NumberFormat(DivCol, "9999")#> </cfif> </td> </cfloop> </tr> </table> </body> </html> ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
