Solved

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

Posted on 2014-02-10
4
339 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

808 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