strantheman
Programmer
I am unable to accurately display a grouped result set on multiple pages. I have an example, and I hope someone can assist me with a solution. Basically STARTROW and MAXROWS aren't helping me get grouped rows.
There are 100 lakes.
There are 5 fishnames per lake.
My join query returns 500 rows, and CFOUTPUT will group and show the lakename column only once per each record.
The nested CFOUTPUT will display a subset of lakes, which is the fish associated to that lake.
Therefore, there should only be 100 total lake rows, and no one lake should ever be displayed twice. If I use STARTROW and MAXROWS in my outermost CFOUTPUT, and MAXROWS is 50 there should be only 2 pages of lakes, however there are 10.
My #start# is incrementing fine, and each page says its showing records 1 - 50 or 51 - 100, but there is actually a third page that says 101 - 150.
My debug output says the query returns 500 rows, and I understand that because of my join, but can't CFOUTPUT and its next / prev style functionality handle grouped output?
<!--- one to many join --->
<CFQUERY name="getMatchingRows" datasource="#ds#">
select distinct
L.lakeid as lid
, L.lakename as lakename
, F.fishid as fid
, F.fishname as fishname
from t_lake L, t_fish F
where L.lakeid = F.lakeid
and UPPER(Q.questiontext) like '%#ucase(keyword)#%'
order by L.lakename, F.fishname
</CFQUERY>
<!--- --->
<CFOUTPUT query="getMatchingRows" group="lid" startrow="#start#" maxrows="50">
#lakename#
<br>
<CFOUTPUT group="fid">
<li>#fishname#
</CFOUTPUT>
<hr>
</CFOUTPUT>
Thanks to anyone who has a suggestion. Id prefer to avoid using arrays or session/ client variables to handle this.
nic
There are 100 lakes.
There are 5 fishnames per lake.
My join query returns 500 rows, and CFOUTPUT will group and show the lakename column only once per each record.
The nested CFOUTPUT will display a subset of lakes, which is the fish associated to that lake.
Therefore, there should only be 100 total lake rows, and no one lake should ever be displayed twice. If I use STARTROW and MAXROWS in my outermost CFOUTPUT, and MAXROWS is 50 there should be only 2 pages of lakes, however there are 10.
My #start# is incrementing fine, and each page says its showing records 1 - 50 or 51 - 100, but there is actually a third page that says 101 - 150.
My debug output says the query returns 500 rows, and I understand that because of my join, but can't CFOUTPUT and its next / prev style functionality handle grouped output?
<!--- one to many join --->
<CFQUERY name="getMatchingRows" datasource="#ds#">
select distinct
L.lakeid as lid
, L.lakename as lakename
, F.fishid as fid
, F.fishname as fishname
from t_lake L, t_fish F
where L.lakeid = F.lakeid
and UPPER(Q.questiontext) like '%#ucase(keyword)#%'
order by L.lakename, F.fishname
</CFQUERY>
<!--- --->
<CFOUTPUT query="getMatchingRows" group="lid" startrow="#start#" maxrows="50">
#lakename#
<br>
<CFOUTPUT group="fid">
<li>#fishname#
</CFOUTPUT>
<hr>
</CFOUTPUT>
Thanks to anyone who has a suggestion. Id prefer to avoid using arrays or session/ client variables to handle this.
nic