hello I'm trying to get a loop. The idea is to just
create a table that shows 2 row and 5 column.
Instead of
1
2
3
4
a.s.o
I want
12345
space writable
678910
I've made a CurrentRow MOD and it working right to left, but
not the space
even if it is possible to loop the table instead of the columns
<table width="500" border="1">
<tr><cfoutput query="testrec" startRow="#StartRow_testrec#" maxRows="#MaxRows_testrec#">
<td>#testrec.tblOnskelista# </td>
<CFIF testrec.CurrentRow MOD 5 IS 0>
</TR>
<TR></TR>
</CFIF>
</cfoutput>
</table>
I saw this exact same question on another forum: http://www.codingforums.com/showthread.php?t=263220
^_^
I tend to avoid the MOD calculation in a loop like this and instead use two loops:
| <table> <cfloop index="variables.i" from="#StartRow_testrec#" to="#EndRow_testrec#" step="5"> <tr> <cfloop index="variables.y" from="#variables.i#" to="#variables.i+5#"> <td><cfif variables.y LTE testrec.rowCount>#testrec.tblOnskelista[variables.y]#<cfelse> </cfif> </td> </cfloop> </tr> </cfloop> </table> |
Couldn't you just do something as simple as this
<table width="500" border="1">
<tr>
<cfoutput query="testrec" startRow="1" maxRows="5">
<td>#testrec.tblOnskelista# </td>
</cfoutput>
</tr>
</table>
<br>
<table width="500" border="1">
<tr>
<cfoutput query="testrec" startRow="6" maxRows="5">
<td>#testrec.tblOnskelista# </td>
</cfoutput>
</tr>
</table>
Kalle4001 wrote:
i get wront when i start next 10 record
<a href="<cfoutput>#CurrentPage#?PageNum_testrec=#Min(IncrementValue(Pag eNum_testrec),TotalPages_testrec)##QueryString_testrec#</cfoutput>">N e xt</a>
now you say only the first 10
This is apparently a new question. Have you resolved the first one?
You can just add if-conditions to control output according to the number of records. Here are examples:
(1)
<cfif testrec.recordcount GTE 1>
<table width="500" border="1">
<tr>
<cfoutput query="testrec" startRow="1" maxRows="5">
<td>#testrec.tblOnskelista# </td>
</cfoutput>
</tr>
</table>
</cfif>
<br>
<cfif testrec.recordcount GTE 6>
<table width="500" border="1">
<tr>
<cfoutput query="testrec" startRow="6" maxRows="5">
<td>#testrec.tblOnskelista# </td>
</cfoutput>
</tr>
</table>
</cfif>
(2)
<cfif testrec.recordcount GTE 11>
<cfoutput query="testrec" startRow="11" maxRows="8">
<cfset link = CurrentPage & "?PageNum_testrec=" & Min(IncrementValue(PageNum_testrec),TotalPages_testrec) & QueryString_testrec>
<a href="#link#">Next</a><br>
</cfoutput>
</cfif>
North America
Europe, Middle East and Africa
Asia Pacific