Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i dynamically group by using <CFOUTPUT GROUP>?

Status
Not open for further replies.

spisupati

Programmer
Joined
Mar 29, 2002
Messages
1
Location
US
I have a problem with <CFOUTPUT GROUP> attribute when i dynamically group based on number of columns user selected.

The logic follows:

<--- This is for first group --->
<CFOUTPUT QUERY=&quot;query_name&quot; GROUP=&quot;#group1#&quot;>
<--- Since this is a dynamic grouping, store the number
of columns that user selected in a list and loop
from outermost group to second. Because first group
always default. --->
<CFLOOP INDEX=&quot;i&quot; FROM=&quot;#ListLen(columnslist)#&quot; TO=&quot;2&quot;
STEP=&quot;-1&quot;>
<--- Inner block to display the data --->
<CFOUTPUT>
<TR>
<TD>
Display data
</TD>
</TR>
</CFOUPUT>

<--- Display subtotals. --->
<TR>
<TD>
Subtotals for group2, group3....etc.,
</TD
</TR>
</CFLOOP>
</CFOUTPUT>

The problem here is the data is displaying twice. For example if the user select 3 columns for grouping. For the second and third groups the data is displaying for each record.

Any idea?

Thanks

 
First of all, you don't show the SQL for the query &quot;query_name&quot;. We will need that to diagnose your problem. Secondly, I seems that you have a misconception of what a GROUP is (as designated by the group attribute of the <cfquery> tag. You seem to think that each column that the use selected is a group, because you refer to one of the columns that the user selected as the &quot;outermost group&quot;. Also, at the bottom of the loop, you comment, &quot;Subtotals for group2, group3....etc.&quot;

Please post your query. Also, please describe (in narrative form) the output that you are trying to get. Describe the format and what data goes in each cell.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top