Solved

Is it possible to refresh page and show remainder of recodset?

Posted on 2003-12-09
19
248 Views
Last Modified: 2013-12-24
I am using the below code to show 45 records in a dual column, the page will refresh every 30 secs.  how ever I would like it to show on the refresh the remainder of the records if they are GT 45 until it hits the final record then it can start again from 1-45?

any insight would be great.
(in case you want to know it will be for a message center that will display all messages received on a screen so people can come pick it up)



code is as follows:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh" content="30">
<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>
</head>

<body>
<cfset numberOfRecordsBeforeHeaderDisplay = 45>
<cfset pageBreakCounter = 0>


<cfset numberofrecords = "#get_mess.recordcount#">
<Cfset TotalPages =  numberofrecords/numberOfRecordsBeforeHeaderDisplay >

<cfset page =1>



<cfoutput query="get_mess">
<!--- Display header --->

<cfif get_mess.currentRow mod numberOfRecordsBeforeHeaderDisplay EQ 1>
 <cfif pageBreakCounter eq 0>
    <!-- start newspaper table -->

 
 
    <div align="center">
      <em><strong>MESSAGE CENTER</strong></em>
      </div>
    <table width="100%" cellpadding="0" cellspacing="0">
   
      <tr>
 </cfif>
 <cfset pageBreakCounter = IncrementValue(pageBreakCounter)>
  <td width="5%">
        <table width="100%" height="90%" cellpadding="0" cellspacing="0">
          <tr>
            <td width="81%" valign="top" align="left">Name</td>
           
           <td width="20">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          </tr>
          <td> </cfif>
          <!--- table cell display --->
          <tr> <font face="Arial, Helvetica, sans-serif" size="2">
            <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#</td>
           
         
            </font>
          <!--- Display close table --->
          <td> <cfif get_mess.currentRow mod numberOfRecordsBeforeHeaderDisplay EQ 0 OR get_mess.currentRow EQ get_mess.recordCount>
        </table>
  </td>
    <cfif pageBreakCounter mod 2 eq 0 OR get_mess.currentRow EQ get_mess.recordCount>
      <cfset pageBreakCounter = 0>
      <!--- close newspaper table --->
  </table>
      <br class="pageBreak">
        <cfset Page=Page+1>
    </cfif>
</cfif>
</cfoutput>

</body>
</html>
0
Comment
Question by:jriver12
  • 9
  • 6
  • 3
  • +1
19 Comments
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9907405

do query



<cfif isDefined("url.start")>
   <cfset iStartRow=#url.iStartRow#+50>
   <cfif iStartRow gt query.recordCount>
      <cfset iStartRow=1>
   </cfif>
<cfelse>
    <cfset iStartRow=1>
</cfif>
<meta http-equiv="Refresh" content="30;URLpage.cfm?start=#iStartRow#">

<cfouptput query="" startrow="iStarRow" maxrows="50">
0
 

Author Comment

by:jriver12
ID: 9907667
the refresh portion works unfortunately I keeps returning the same record set.

<!--- get the messages --->
<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif isDefined("url.start")>
   <cfset iStartRow=#url.iStartRow#+45>
   <cfif iStartRow gt query.recordCount>
      <cfset iStartRow=1>
   </cfif>
<cfelse>
    <cfset iStartRow=1>
</cfif>
<meta http-equiv="Refresh" content="30;URLpage.cfm?start=#iStartRow#">



<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="45"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9907726
do you have the met tag between cfoutput tags?

<cfoutput>
   <meta http-equiv="Refresh" content="30;URLpage.cfm?start=#iStartRow#">
</cfoutput>
0
 

Author Comment

by:jriver12
ID: 9907883
this is what I have done with no luck.
<!--- get the messages --->
<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif isDefined("url.start")>
   <cfset iStartRow=#url.iStartRow#+5>
   <cfif iStartRow gt query.recordCount>
      <cfset iStartRow=1>
   </cfif>
<cfelse>
    <cfset iStartRow=1>
</cfif>
<cfoutput><meta http-equiv="Refresh" content="5;URLpage.cfm?start=#iStartRow#"><cfoutput>



<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="10"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>

0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9907890
this line

<cfif iStartRow gt query.recordCount>

should be

<cfif iStartRow gt get_mess.recordCount>
 i put the query.recordcount as a spacer

ok try this

<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif not isDefined("url.start")>
  <cfset iStartRow=1>
<cfelse>
   <cfif url.start gt get_mess.recordCount>
      <cfset iStartRow=1>
   </cfif>
</cfif>
<cfoutput>
<meta http-equiv="Refresh" content="30;URLpage.cfm?start=#evaluate('#iStartRow#'+45)#">
</cfoutput>


<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="45"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9907910
left a line out


<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif not isDefined("url.start")>
  <cfset iStartRow=1>
<cfelse>
   <cfif url.start gt get_mess.recordCount>
      <cfset iStartRow=1>
   <cfelse>
       <cfset iStartRow=#url.start#>
   </cfif>
</cfif>
<cfoutput>
<meta http-equiv="Refresh" content="30;URLpage.cfm?start=#evaluate('#iStartRow#'+45)#">
</cfoutput>


<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="45"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>
0
 

Author Comment

by:jriver12
ID: 9907937
still receiving the same recordset.

<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif not isDefined("url.start")>
  <cfset iStartRow=1>
<cfelse>
   <cfif url.start gt get_mess.recordCount>
      <cfset iStartRow=1>
   <cfelse>
       <cfset iStartRow=#url.start#>
   </cfif>
</cfif>
<cfoutput>
<meta http-equiv="Refresh" content="5;URLpage.cfm?start=#evaluate('#iStartRow#'+10)#">
</cfoutput>


<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="10"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9908048
sorry typo

try this as teh meta tag

<meta http-equiv="Refresh" content="30;url=URLpage.cfm?start=#evaluate('#iStartRow#'+45)#">
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9910054
I guess using CFFLUSH wld help here

read help on it & try it out !
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 11

Expert Comment

by:hart
ID: 9910255
ok how about this

<cfparam default="1" name="iStartRow">

<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif iStartRow gte get_mess.RecordCount>
  <cfset iStartRow = 1>
</cfif>

<HTML>
<HEAD>
<meta http-equiv="Refresh" content="30;url=pagename.cfm?iStartRow =<cfoutput>#evaluate(iStartRow+45)#</cfoutput>">
</HEAD>
<BODY>
<table>
<tr>
<td> Messages have been rececived for the following</td>
</tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="45"><tr>
<td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
</td>
</tr>
</cfoutput>
</table>
</BODY>
</HTML>


let me know

Regards
Hart
0
 
LVL 11

Expert Comment

by:hart
ID: 9910259
there will be space in between iStartRow =<cfoutput>#
kindly remove it and make it to iStartRow=<cfoutput>#
in the meta tag

Regards
Hart
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 500 total points
ID: 9911931
here is the complete code bu tin the meta tag you really should have a value greater that 5, that value is the number of seconds until the page refreshes, go with 30 or at least 20

<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif not isDefined("url.start")>
  <cfset iStartRow=1>
<cfelse>
   <cfif url.start gt get_mess.recordCount>
      <cfset iStartRow=1>
   <cfelse>
       <cfset iStartRow=#url.start#>
   </cfif>
</cfif>
<cfoutput>
<meta http-equiv="Refresh" content="5;url=URLpage.cfm?start=#evaluate('#iStartRow#'+10)#">
</cfoutput>

<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="10"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>

</table>
0
 

Author Comment

by:jriver12
ID: 9911961
Jester_48
Thanks for the insight on the meta time I had set it to 5 because I did not want to wait during testing.  However the last correction on the meta worked flawlessly. thanks for the assistance and time with this code.
0
 

Author Comment

by:jriver12
ID: 9911971
Thanks to all to have participated in this thread your assistance is and always will be greatly appreciated.

Thanks again.
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9911987
np...
glad i could help

i apologize for the typos, can't type worth a damn, kind of a bad thing for someone in my job

;-)
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9911991
thanks for the points
0
 

Author Comment

by:jriver12
ID: 9912018
I Feel You Pain.

And your welcome, would have offered more but EE limits me.

;^0
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9912046
>>would have offered more but EE limits me
thanks
but ,hey... no worries
0
 
LVL 11

Expert Comment

by:hart
ID: 9918053
did u even try my post it was more simplified ???

Regards
Hart
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now