- see footer for list info -<
Cracked it ..... At last !

Thanks for all the help ....

http://www.bgfl.org/cfpages/bullying/test.cfm?repid=1

This is how I finally did it ....

<!--- Get the bullying types to use as the column headers --->
<cfquery name="GetColumnHeaders" datasource="#Application.RacistDSN#">
        SELECT tblBullyingTypes.BullyingTypeIDPK,
                tblBullyingTypes.BullyingType
        FROM tblBullyingTypes
        ORDER BY BullyingTypeIDPK
</cfquery>

<!--- Which report do you want? --->

<cfswitch expression="#url.RepID#">
        <cfcase value="1">
                <!--- REPORT #1 --->
                <!--- Get the details of report #1--->
                <cfquery name="Report1" datasource="#Application.RacistDSN#">
                        SELECT tblIncidents.IncidentIDPK,
                                tblIncidents.DFESNo,
                                tblIncidents.IncidentDate,
                                tblIncidentToBullying.BullyingTypeIDFK,
                                tblBullyingTypes.BullyingType
                        FROM tblIncidentToBullying
INNER JOIN tblBullyingTypes ON tblIncidentToBullying.BullyingTypeIDFK = tblBullyingTypes.BullyingTypeIDPK INNER JOIN tblIncidents ON tblIncidentToBullying.IncidentIDFK = tblIncidents.IncidentIDPK
                        ORDER BY IncidentIDPK
                </cfquery>




                <!--- HEADER --->
                <!---
                <cfoutput>
                        <table border="0" class="EDDIEitemTable" width=95%>
                                <tr>
                                        <td valign="top" colspan="4">
                                                <b>#Session.User#</b>
                                        </td>
                                        <td valign="top" colspan="4">
                                                <b>#Session.DFESNo#</b>
                                        </td>
                                </tr>
                        </table>
                </cfoutput>
                --->
                <!--- Spacer --->
                <table cellSpacing="0" cellPadding="0" width="95%" border="0">
                        <tr><td height="10"></td></tr>
                </table>

                <!--- Column Headings --->
                <table style="PADDING-RIGHT: 0px;
                        PADDING-LEFT: 10px;
                        PADDING-BOTTOM: 0px;
                        PADDING-TOP: 0px"
                        cellSpacing="0" cellPadding="0" width="95%" border="1">
                        <tr>
                                <td align="top">Incident Ref No.</td>
                                <cfoutput query="GetColumnHeaders">
                                        <td align="top">
                                                #BullyingType#
                                        </td>
                                </cfoutput>
                        </tr>


                        <cfoutput Query="Report1" group="IncidentIDPK">

                                <tr>
                                        <td align="top">
                                                #IncidentIDPK#
                                        </td>
                                                <cfset tempID = 
#Report1.BullyingTypeIDFK#>
                                                <!--- Set the colspan --->

                                                <cfoutput>

                                                <cfset span = 
(#Report1.BullyingTypeIDFK# - #tempID# - 1)>
Record = #report1.currentrow# Temp ID = #TempID# Bullying ID = #Report1.BullyingTypeIDFK# Span = #span#

                                                        <!--- Is this the first 
column --->
                                                        <cfif 
(#Report1.BullyingTypeIDFK# eq 1)>
                                                                <td>
                                                                        
#Report1.BullyingType#
                                                                </td>
                                                        </cfif>

<!--- Is the span greater than 1 and this is not the first column --->
                                                        <cfif (#span# GT 1) AND 
(#Report1.BullyingTypeIDFK# neq 1) >
                                                                <td align="top" 
colspan=#span#></td>
                                                                <td>
                                                                        
#Report1.BullyingType#
                                                                </td>
                                                        </cfif>

<!--- Are the two values for temp and Id the same and this is not the first record ---> <cfif (#Report1.BullyingTypeIDFK# eq #tempID#) AND (#Report1.BullyingTypeIDFK# neq 1)>
                                                                <cfset Newspan = 
VAL(#Report1.BullyingTypeIDFK#-1)>
                                                                NewSpan = 
#NewSpan#
                                                                <td align="top" 
colspan=#NewSpan#></td>
                                                                <td>
                                                                        
#Report1.BullyingType#
                                                                </td>
                                                        </cfif>

                                                        <!--- Is the ID minus the 
Temp = 1 --->
                                                        <cfif 
#Report1.BullyingTypeIDFK# - #tempID# eq 1>
                                                                <td>
                                                                        
#Report1.BullyingType#
                                                                </td>
                                                        </cfif>

                                                        <!--- Is the span equal to 
 1 and this is not the first column --->
                                                        <cfif (#span# EQ 1) AND 
(#Report1.BullyingTypeIDFK# neq 1) >
                                                                <td align="top" 
colspan=#span#></td>
                                                                <td>
                                                                        
#Report1.BullyingType#
                                                                </td>
                                                        </cfif>

                                                        <cfset tempID = 
#Report1.BullyingTypeIDFK#>
                                                </cfoutput>

                                </tr>
                        </cfoutput>
                </table>
        </cfcase>
</cfswitch>


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to