Link to home
Start Free TrialLog in
Avatar of Panos
PanosFlag for Germany

asked on

Coldfusion Horizontal-"loop"

Hello experts.
There is a nice tutorial for horizontal "loop" on  this site:http://cfproject.co.uk/index.cfm/2008/11/14/Horizontal-Loop.
The problem i have is when i split the output in more pages(use nrecords and startrow-maxrows).
When i select f.e nrecords = 10 ,the second page(third.....) will not split the output with a new row because the currentrow can never be 5.
Any help?
Look at the test code
<cfif Url.nrecords EQ "">
  <cfset Url.nrecords = Form.nrecords>
</cfif>
<cfset MaxRows_queryartikel="#Url.nrecords#">
<cfset StartRow_queryartikel=Min((PageNum_queryartikel-1)*MaxRows_queryartikel+1,Max(queryartikel.RecordCount,1))>
<cfset EndRow_queryartikel=Min(StartRow_queryartikel+MaxRows_queryartikel-1,queryartikel.RecordCount)> 
<cfset multiple = 5>
<table width="300" border="0" cellspacing="1" cellpadding="1">
<tr>
<cfoutput query="queryartikel" startRow="#StartRow_queryartikel#" maxRows="#MaxRows_queryartikel#">
<td>#items.name#</td>
<cfif CurrentRow eq multiple>
</tr><tr>
<cfset multiple = multiple + 5>
</cfif>
</cfoutput>
</tr>
</table>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of azadisaryev
azadisaryev
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Panos

ASKER

Hi.
Sorry for the late response.
I have tested the code in my original page where multiple=4 .The result is that when i have nrecords = 10 and the number of outputs are 18,ihave in the first page two rows with 4 outputs and one row with 2 outputs.In the next page 1 row with 2 outputs ,one with 4 outputs and one with two outputs.
It should be in the second page two rows with each 4 outputs.Any idea why this happens?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Panos

ASKER

Yes azadi.
Now it is working  perfect.A good experience of the mod function!
Avatar of Panos

ASKER

Thank you
regards
panos