Solved

Display percent complete on a query???

Posted on 2004-03-30
6
252 Views
Last Modified: 2013-12-24
Hello Experts,

I have looked around on this forum don't haven't found exactly what I am looking for...

I am querying a database and creating a flat file.  This will take from 1 minute to 3 minutes depending on the query parameters and congestion.

Here is the code:

<!--- run your query --->
  <cfquery name="daschedule" datasource="#db#" dbtype="ODBC">
      SELECT CLASS
     FROM COURSE_LIST
  </cfquery>


<cfset outputfile = "#GetDirectoryFromPath(GetCurrentTemplatePath())#schedfile.txt">
<cfset linesperwrite = 1000>
<cfset crlf = Chr(13) & Chr(10)>
<cffile action="write" file="#outputfile#" output="" addnewline="no">
<cfset x = ""> 
<cfset linecount = 0>

<cfoutput query="daschedule">
   <cfif (left(#CLASS_IND#, 8) EQ '#yt#714' OR
        left(#CLASS_IND#, 8) EQ '#yt#887' OR
            left(#CLASS_IND#, 8) EQ '#yt#843' OR
            left(#CLASS_IND#, 8) EQ '#yt#833' OR
            left(#CLASS_IND#, 8) EQ '#yt#734' OR
            left(#CLASS_IND#, 8) EQ '#yt#721' OR
            left(#CLASS_IND#, 8) EQ '#yt#722' OR
            left(#CLASS_IND#, 8) EQ '#yt#797' OR
            left(#CLASS_IND#, 8) EQ '#yt#723' OR
            left(#CLASS_IND#, 8) EQ '#yt#725' OR
            left(#CLASS_IND#, 8) EQ '#yt#726' OR
            left(#CLASS_IND#, 8) EQ '#yt#728' OR
            left(#CLASS_IND#, 8) EQ '#yt#733' OR
            left(#CLASS_IND#, 8) EQ '#yt#735' OR
            left(#CLASS_IND#, 8) EQ '#yt#739' OR
            left(#CLASS_IND#, 8) EQ '#yt#852' OR
            left(#CLASS_IND#, 8) EQ '#yt#774' OR
            left(#CLASS_IND#, 8) EQ '#yt#790') >

       <cfset data =  #daschedule.CLASS_IND#>
        
         <cfset site = mid(#daschedule.CLASS#, 6, 3)>
         <cfset course = mid(#daschedule.CLASS#, 9, 9)>
                   
       <cfset x = x & "#site#,#course#,#lineNumber#" & crlf>
       <cfset linecount = linecount + 1>
       <cfif linecount gte linesperwrite>
       <cffile action="append" file="#outputfile#" output="#x#" addnewline="no">
       <cfset x = ""> 
       <cfset linecount = 0>
       </cfif>
         <cfset lineNumber = lineNumber + 1>
       </cfif>
 </cfoutput>
 <!--- Don't forget to dump any remaining lines to the file --->
<cffile action="append" file="#outputfile#" output="#x#" addnewline="no">
 

This process works great but it takes awhile.  Basic study in Human Factors will tell you that any wait longer than 30 seconds requires some sort of progress indcator for the user.  While this process is running I would like to display a percent complete or progress bar indicating how much time is left.

I am using ColdFusion 4.5 ( will be upgrading to MX soon but this needs to work in 4.5 for now - say this because CFFLUSH doesn't seem to work in 4.5).

Any suggestions would be helpful.
0
Comment
Question by:shogun5
[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
6 Comments
 
LVL 35

Accepted Solution

by:
mrichmon earned 250 total points
ID: 10724839
I am not sure that you can do this in CF 4.5 since from what I understand there is really no way to communicate between the page and the DB server in CF 4.5  So that means that there would be no way to show any progress.  If you know about how long it takes then what you could do is fake a progress indicator in javascript that really isn't tied to the query, but that accounts for worst case scenario and then is replaced by the results when they actually get pulled.  It would often finish sooner if you have a 1-3 minute window and you base the progress bar on the 3 minutes, but people never mind if things finish faster.  :o)
0
 
LVL 5

Expert Comment

by:Seth_Bienek
ID: 10724861
Hi shogun5,

Without being able to use cfflush, this gets complicated.

The only thing I can think of would be to pop up a 'please wait' window on the page before your processing page, then keep it in front until the processing page is finished, and have the processing page close the popup.

How soon will you be upgrading to MX?  Maybe this is a good opportunity to put that move on the fast track. :)

Lemme know if you need some code samples for this approach.

Regards,

Seth
0
 

Author Comment

by:shogun5
ID: 10728486

Okay, well I kind of figured that.  

Thanks, both of your, for your inputs.  I'll just wait until our company installs ColdFusion MX.

-mike
0
 
LVL 6

Expert Comment

by:PE_CF_DEV
ID: 10735816
You could put this in a frame,  and do as mrichmon suggested and put a 'worse case' countdown on it. this frame will load immediately while the other frame waits to complete.
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

756 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