Solved

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

Posted on 2003-12-09
19
256 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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
 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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