Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tracing the Progress of Transactions 3

Status
Not open for further replies.

Ildegardo

Technical User
Feb 23, 2008
12
IT
I have many transactions (like APPEND FROM, COPY TO, REPLACE ALL) working on very big tables, and therefore lasting few seconds before they are completed.
Sometimes the user of the program could get the feeling that it is no more working, I would like therefore to trace the progress of the different functions, showing for example a thermometer window while they are doing their job.
Which possibility I have to introduce this feature?
 
Thank you Mike.
I’m aware about the Thermometer class in VFP. However I would like to know to which feature (variable most probably) should I associate it to trace the progress.

Thank you again.
 
Ildegardo,

Given that your process consists of single time-consuming commands like REPLACE ALL and COPY TO, the thermometer would only update itself between those commands. So, if you were running three of four such commands, one after the other, the user would see nothing for several seconds, then a sudden jump, then another pause, and so on.

Another solution would be to use an animated GIF, for example like the one you see in Windows when you copy files. I know this doesn't properly reflect the progress of the task, and doesn't tell the user that the process is still running, but it might still provide some reassurance. I have used this technique myself with acceptable results.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
For commands like those, anything that allows you to update a progress bar is going to slow down the command. You'd have to put a function call into the FOR clause, for example.

Could you instead put up a form with an animated GIF and leave it there until the thing is done? It wouldn't show actual progress, but would show movement. (I think this will work, but it's possible it won't actually update while processing is occurring.)

Tamar
 
This may be helpful

Code:
* Update frequency is every 10 records, Change to any
* other number as required.
set odometer to 10
define window WinStatus from 10,10 to 14,40
activate window WinStatus
set talk window WinStatus
? "Updating, Please wait ..."
use MyTable
replace all FIELD1 with "ABCD"
 
Mike (Yearwood),

What you said about VFP's speed and Rushmore is, of course, absolutely correct. No-one would argue with the need to optimise your code as much as possible.

But I can't help feeling that's a separate issue from that of keeping the user informed of what's going on. However well optimised the query, if the user has to wait more than a few moments, you need to give them feedback.

Last week, I rewrote a particularly complex query. It previously took 40 - 50 minutes. Now, by re-doing the SQL, plus adding a couple of new indexes, I've got it down to about 90 seconds.

But even 90 seconds is still a heck of a long time for the user to stare at the screen, wondering if anything is going on. In those cases, you still need some sort of feedback mechanism to reassure the user.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
But the information you need to provide for a 90-second query is a lot different that what you need for a 40-minute query. For 90 seconds, a simple "Processing. Please wait ..." kind of message should be enough.

Tamar
 
Another way to do may be to add a timer class and display the message in your own style, "Procressing, Please wait ... 12:37:42".

No problem with scan (replce/copy/append) but will consume more time, with great flexibility.

re: set talk to WinStatus. If the window's small size is just to capture the record number in progress, it will give somesort of half dressed solution. May have a fancy form and then create a small WinStatus window where all the records processed counter will show the progress.

 
Look at how Windows Explorer does file copies. There is an animation of pages flying from one folder to another. There's a reason it's shown this way...any thing that hooks into the actual processing will cause that processing to slow down. Mike was correct in saying you should use an animated gif. There are some that ship with VFP.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 

The applications I am handling most often are not exactly for end users, so no animation usually needed (even though I would probably consider it for some cases), so I use WAIT WINDOW to inform people running the programs of what's going on.

Something to this effect (using compiling complex reports - long and time-consuming process - as an example):

Code:
[i]<hide the form where choices for the reports are made>
<call the report compilation program>[/i]

x=SECONDS()
waitmsg=' COMPILING REPORTS... '+CHR(13)+CHR(13)+' Start time  '+TIME()
WAIT waitmsg WINDOW NOWAIT NOCLEAR

[i]<processing>[/i]

x=ROUND((SECONDS()-x)/60, 0)
waitmsg=waitmsg+CHR(13)+' End time  '+TIME()+CHR(13)+ ;
        ' Processing time = '+ALLTRIM(STR(x))+' min.'
WAIT waitmsg WINDOW NOWAIT NOCLEAR

[i]<display the form with printing/preview/exporting options>

<Issue WAIT CLEAR when needed - usually when the person who may have left their desk or switched to other windows during that time have seen the message, knows that the process is finished, and started to navigate the form.>[/i]

Works for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top