Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CurrentRow MOD And Br

Guest
Jun 01, 2012 Jun 01, 2012

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>

2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2012 Jun 01, 2012

I think you'll find an empty <tr> doesn't - intrinsically - have any height.

--
Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2012 Jun 01, 2012

Tru....

that have no funktion and i have remove that. still i can not find how to make space to break it out and make 2 table

table 1

1 2 3 4 5

space

table 2

6 7 8 9

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2012 Jun 01, 2012

In the spot where you want your space, add a set of td tags containing a non breaking space.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2012 Jun 01, 2012

I saw this exact same question on another forum: http://www.codingforums.com/showthread.php?t=263220

^_^

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2012 Jun 01, 2012

Yes is the same..

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2012 Jun 04, 2012

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 04, 2012 Jun 04, 2012

i get wront when i start next 10 record

<a href="<cfoutput>#CurrentPage#?PageNum_testrec=#Min(IncrementValue(PageNum_testrec),TotalPages_testrec)##QueryString_testrec#</cfoutput>">Next</a>

now you say only the first 10

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2012 Jun 04, 2012

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>">Ne xt</a>

now you say only the first 10

This is apparently a new question. Have you resolved the first one?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 04, 2012 Jun 04, 2012

I've managed to get to the first part. the problem is if it is not 10 record when it can not display it, which gets a little problem at page

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2012 Jun 04, 2012

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 05, 2012 Jun 05, 2012

the code get following error

Element RECORDCOUNT is undefined in TESTREC.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2012 Jun 05, 2012

I am assuming that your query is called testrec.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 05, 2012 Jun 05, 2012

yes.. my query is called testrec

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2012 Jun 05, 2012
LATEST

Then testrec.recordcount should exist! Make sure you put the above code in a position where the query is defined. For example, right after the cfquery tag.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 01, 2012 Jun 01, 2012

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>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources