Solved

Display percent complete on a query???

Posted on 2004-03-30
6
254 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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

627 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