Solved

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

Posted on 2014-02-10
4
330 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 24

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 24

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 24

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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

707 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

15 Experts available now in Live!

Get 1:1 Help Now