I am having trouble with displaying the data in a report the way that I need it.
I want it to display like this:
Show all the categories on the first row. Then show each count under the correct category and in the correct Date row. For example, in 2001 - February there is 1 event in category 2. (The date format is yy-mm for now)
Is this possible?
<TR>
<TD> DATE</TD> </TD><TD>EVENT CATEGORY 1</TD> <TD> EVENT CATEGORY 2</TD> <TD>EVENT CATEGORY 3</TD> ...
</TR>
(yy-mm)
<TR><TD>01 02</TD> <TD>1</TD>
<TR><TD>02 02</td> <TD>1</TD>
This is my current display Results is :
EVENT CATEGORY 1
EVENT CATEGORY 1 02 01 2
EVENT CATEGORY 1 02 02 14
EVENT CATEGORY 1 02 03 5
EVENT CATEGORY 1 02 04 1
EVENT CATEGORY 2
EVENT CATEGORY 2 01 02 1
EVENT CATEGORY 2 02 02 1
This is my query:
<CFQUERY name="categories" datasource="#PrimaryDataSource#">
SELECT eventcategory_id
FROM incidentcategory
</CFQUERY>
<table>
<CFOUTPUT>
<CFLOOP query="categories">
<CFQUERY name="category_by_month_test" datasource="#PrimaryDataSource#">
SELECT count(e.event_id) as "event_cat_total", count(to_char(e.notification_date, 'YY MM')) as "cat_counts",
to_char(e.notification_date, 'YY MM') as "eachMonth", e.eventcategory_id
FROM event e, eventcategory c
WHERE e.eventcategory_id = c.eventcategory_id
AND e.eventcategory_id = '#eventcategory_id#'
GROUP BY to_char(notification_date, 'YY MM'), e.eventcategory_id
ORDER BY "eachMonth", e.eventcategory_id
</CFQUERY>
<tr>
<td><b>EVENT CATEGORY #eventcategory_id#</b></td>
</tr>
<CFLOOP QUERY = "category_by_month_test">
<tr>
<td><b>event CATEGORY #eventcategory_id#</b></td>
<td>#eachMonth# </td>
<td>#cat_counts#</td>
</CFLOOP>
</tr>
</CFLOOP>
</CFOUTPUT>
</table>
</CFLOOP>
</CFOUTPUT>
<CFOUTPUT>
Thanks in advance,
olmos.
I want it to display like this:
Show all the categories on the first row. Then show each count under the correct category and in the correct Date row. For example, in 2001 - February there is 1 event in category 2. (The date format is yy-mm for now)
Is this possible?
<TR>
<TD> DATE</TD> </TD><TD>EVENT CATEGORY 1</TD> <TD> EVENT CATEGORY 2</TD> <TD>EVENT CATEGORY 3</TD> ...
</TR>
(yy-mm)
<TR><TD>01 02</TD> <TD>1</TD>
<TR><TD>02 02</td> <TD>1</TD>
This is my current display Results is :
EVENT CATEGORY 1
EVENT CATEGORY 1 02 01 2
EVENT CATEGORY 1 02 02 14
EVENT CATEGORY 1 02 03 5
EVENT CATEGORY 1 02 04 1
EVENT CATEGORY 2
EVENT CATEGORY 2 01 02 1
EVENT CATEGORY 2 02 02 1
This is my query:
<CFQUERY name="categories" datasource="#PrimaryDataSource#">
SELECT eventcategory_id
FROM incidentcategory
</CFQUERY>
<table>
<CFOUTPUT>
<CFLOOP query="categories">
<CFQUERY name="category_by_month_test" datasource="#PrimaryDataSource#">
SELECT count(e.event_id) as "event_cat_total", count(to_char(e.notification_date, 'YY MM')) as "cat_counts",
to_char(e.notification_date, 'YY MM') as "eachMonth", e.eventcategory_id
FROM event e, eventcategory c
WHERE e.eventcategory_id = c.eventcategory_id
AND e.eventcategory_id = '#eventcategory_id#'
GROUP BY to_char(notification_date, 'YY MM'), e.eventcategory_id
ORDER BY "eachMonth", e.eventcategory_id
</CFQUERY>
<tr>
<td><b>EVENT CATEGORY #eventcategory_id#</b></td>
</tr>
<CFLOOP QUERY = "category_by_month_test">
<tr>
<td><b>event CATEGORY #eventcategory_id#</b></td>
<td>#eachMonth# </td>
<td>#cat_counts#</td>
</CFLOOP>
</tr>
</CFLOOP>
</CFOUTPUT>
</table>
</CFLOOP>
</CFOUTPUT>
<CFOUTPUT>
Thanks in advance,
olmos.