0
Rowspan question
Explorer
,
/t5/coldfusion-discussions/rowspan-question/td-p/33382
Oct 03, 2006
Oct 03, 2006
Copy link to clipboard
Copied
I have an output displaying by groups in this case court 1,
court 2, court 3, etc. Each grouping may output a different number
of rows. I would love to have a rowspan for each grouping so I
could drop a graphic in there but I don't know how to do it since
it is not a fixed number of rows for each group. Is there a way to
generate a rowspan dynamically? I've included my code below. Thank
you very much.
<table width="100%" border="1" bgcolor="#87C486" bordercolor="#006633">
<tr>
<td align="center"><b>Court Assignments for: <cfoutput>#DateFormat("#Now()#", "mm/dd/yyyy")#</cfoutput></b></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="reg">
<tr>
<td colspan="7" height="20"></td>
</tr>
<cfoutput query="getAllCourts" group="courtID">
<tr>
<td id="larger" colspan="7"><b>- Court #uCase(CourtID)# -</b></td>
</tr>
<cfoutput>
<!--- Two shades of gray --->
<tr id="small" valign="middle" bgcolor="#IIf(CurrentRow Mod 2, DE('D8DCD8'), DE('C2FFC1'))#">
<td width="5%" height="21"></td>
<td width="8%">#timeformat(BeginTime,"h:mm tt")#</td>
<td width="8%">#timeformat(endtime,"h:mm tt")#</td>
<td width="15%">
<cfif isdefined("InstructorID") and InstructorID neq "">
<!--- Query to get the Instructor's name. --->
<cfquery name="getInstName" datasource="#request.dsn#" dbtype="ODBC">
SELECT InstructorName
FROM EL_Instructor
Where InstructorID = #InstructorID#
</cfquery>
#getInstName.InstructorName#
<cfelse>
</cfif>
</td>
<td width="15%">#CustomerName#</td>
<td width="39%">#additionalInfo#</td>
<td width="10%" align="center"><a href="#myself##xfa.editCourtAssignment#">Edit</a></td>
</tr>
</cfoutput>
<tr>
<td height="30"></td>
</tr>
</cfoutput>
</table>
<table width="100%" border="1" bgcolor="#87C486" bordercolor="#006633">
<tr>
<td align="center"><b>Court Assignments for: <cfoutput>#DateFormat("#Now()#", "mm/dd/yyyy")#</cfoutput></b></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="reg">
<tr>
<td colspan="7" height="20"></td>
</tr>
<cfoutput query="getAllCourts" group="courtID">
<tr>
<td id="larger" colspan="7"><b>- Court #uCase(CourtID)# -</b></td>
</tr>
<cfoutput>
<!--- Two shades of gray --->
<tr id="small" valign="middle" bgcolor="#IIf(CurrentRow Mod 2, DE('D8DCD8'), DE('C2FFC1'))#">
<td width="5%" height="21"></td>
<td width="8%">#timeformat(BeginTime,"h:mm tt")#</td>
<td width="8%">#timeformat(endtime,"h:mm tt")#</td>
<td width="15%">
<cfif isdefined("InstructorID") and InstructorID neq "">
<!--- Query to get the Instructor's name. --->
<cfquery name="getInstName" datasource="#request.dsn#" dbtype="ODBC">
SELECT InstructorName
FROM EL_Instructor
Where InstructorID = #InstructorID#
</cfquery>
#getInstName.InstructorName#
<cfelse>
</cfif>
</td>
<td width="15%">#CustomerName#</td>
<td width="39%">#additionalInfo#</td>
<td width="10%" align="center"><a href="#myself##xfa.editCourtAssignment#">Edit</a></td>
</tr>
</cfoutput>
<tr>
<td height="30"></td>
</tr>
</cfoutput>
</table>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/rowspan-question/m-p/33383#M3535
Oct 03, 2006
Oct 03, 2006
Copy link to clipboard
Copied
this q of q might give you something useful
select courtid, count(courtid) as potentially_useful_number
from getAllCourts
group by courtid
select courtid, count(courtid) as potentially_useful_number
from getAllCourts
group by courtid
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Winston2
AUTHOR
Explorer
,
/t5/coldfusion-discussions/rowspan-question/m-p/33384#M3536
Oct 03, 2006
Oct 03, 2006
Copy link to clipboard
Copied
In trying to understand your response I laid it out and sent
the result to an array then output the array and it clearly works.
It generated the correct number for each grouping just as you
hinted that it would. Below is what I used to test it.
<cfquery name="numbForRowSpan" dbtype="query">
select CourtID, count(CourtID) as pun
from getAllCourts
Group by CourtID
</cfquery>
<!--- Create a 1D array from the above query. 1D because it is only a single column.--->
<cfset CorrectCourtNo = ArrayNew(1)>
<!--- Now populate the array. --->
<cfloop query="numbForRowSpan">
<cfset CorrectCourtNo[#currentRow#]="#pun#">
</cfloop>
<!--- Displaying data from the 1D array. --->
<table id="reg">
<cfoutput query="numbForRowSpan">
<tr>
<td>#CorrectCourtNo[currentRow]#</td>
</tr>
</cfoutput>
</table>
My dilemma now is where does it go in my code? When I placed where I thought it should go, CF generated a "Can't put a cfoutput within a cfoutput message. Thanks for your help.
<cfquery name="numbForRowSpan" dbtype="query">
select CourtID, count(CourtID) as pun
from getAllCourts
Group by CourtID
</cfquery>
<!--- Create a 1D array from the above query. 1D because it is only a single column.--->
<cfset CorrectCourtNo = ArrayNew(1)>
<!--- Now populate the array. --->
<cfloop query="numbForRowSpan">
<cfset CorrectCourtNo[#currentRow#]="#pun#">
</cfloop>
<!--- Displaying data from the 1D array. --->
<table id="reg">
<cfoutput query="numbForRowSpan">
<tr>
<td>#CorrectCourtNo[currentRow]#</td>
</tr>
</cfoutput>
</table>
My dilemma now is where does it go in my code? When I placed where I thought it should go, CF generated a "Can't put a cfoutput within a cfoutput message. Thanks for your help.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/coldfusion-discussions/rowspan-question/m-p/33385#M3537
Oct 03, 2006
Oct 03, 2006
Copy link to clipboard
Copied
You would use the results of this information as you are
building the
table with all the other data in it.
<table ...>
<cfoutput ...>
<tr>
<td rowsspan="rowSpanCount"><!-- Use the rowspan number for this
section of data --><img ....></td>
<td>Other data for this section</td>
<td>still more data</td>
<tr>
<tr><td>even more data for this section</td><td>even more</td><tr>
</cfoutput>
</table>
table with all the other data in it.
<table ...>
<cfoutput ...>
<tr>
<td rowsspan="rowSpanCount"><!-- Use the rowspan number for this
section of data --><img ....></td>
<td>Other data for this section</td>
<td>still more data</td>
<tr>
<tr><td>even more data for this section</td><td>even more</td><tr>
</cfoutput>
</table>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

