Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display percent complete on a query???

Posted on 2004-03-30
6
Medium Priority
?
256 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 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

721 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