Solved

Have to simulate Cfquery load times and cfflush isn't working!!! Thoughts?

Posted on 2014-02-10
4
341 Views
Last Modified: 2014-02-12
Hey guys -
I have to build a interactive loading bar to show page loads while various cfquery scripts run.  My goal was to use cfflush to break up the queries and run a javascript to update the loading bar.  For whatever reason, the whole page is just churning and then running all of the code at the end.  Here's my script (nprogress is the loading bar function I'm using, start() starting it, inc() increasing it):

  <script>
    NProgress.start();
 </script>


 BLA BLA
 <cfflush>

 <BR><BR>adfajdlfkajsdflk
<cfquery datasource="MOLMS">
SELECT GETDATE() CurrentTime
WAITFOR DELAY '00:00:05' ---- 5 Second Delay
SELECT GETDATE() CurrentTime 
</cfquery>

 
  <script>

NProgress.inc();
 </script>

 <cfflush>
 
 
 <BR><BR>adfajdlfkajsdflk
<cfquery datasource="MOLMS">
SELECT GETDATE() CurrentTime
WAITFOR DELAY '00:00:05' ---- 5 Second Delay
SELECT GETDATE() CurrentTime 
</cfquery>


  <script>

NProgress.inc();
 </script>

Open in new window


Any thoughts on why cfflush isn't dumping data?  Obviously the queries are fake, but since the time delay is happening on the SQL side, this is more or less the exact way the page would load if it was real data.  


Thanks!!
0
Comment
Question by:milestonetech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 25

Expert Comment

by:dgrafx
ID: 39850261
try putting the following before your script & flush:

<cfoutput>#repeatString(" ", 73729)#</cfoutput>
<script>NProgress.inc();</script>
 <cfflush>
0
 

Author Comment

by:milestonetech
ID: 39850817
thanks for the response dgrafx, no luck man....
0
 
LVL 25

Accepted Solution

by:
dgrafx earned 500 total points
ID: 39851224
you should have some form of success
it may be your script NProgress.inc - i don't know what code you're using in it ...

here is a proof of concept

First run this:
<cfloop from="1" to="10" index="ii">
      #getTickCount()#<br /><br />
      <cfthread action="sleep" duration="100" />
      <CFFLUSH>
</cfloop>
</cfoutput>
Done
<CFABORT>

Then run this:
<cfloop from="1" to="10" index="ii">
      #getTickCount()#<br /><br />#repeatString(" ", 73729)#
      <cfthread action="sleep" duration="100" />
      <CFFLUSH>
</cfloop>
</cfoutput>
Done
<CFABORT>

The only difference is the use of repeatString which adds content so there is something to flush.
btw - the cfthread is acting as a time waster so as to test flushing.

let me know ...
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 39854012
Thanks for the points!

I'm hoping this was of value to you and you didn't just accept for general purposes ...

Good Luck!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

738 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