Link to home
Start Free TrialLog in
Avatar of Mike Rudolph
Mike RudolphFlag for United States of America

asked on

Display percent complete on a query???

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.
ASKER CERTIFIED SOLUTION
Avatar of mrichmon
mrichmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Seth_Bienek
Seth_Bienek

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
Avatar of Mike Rudolph

ASKER


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