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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Progress of report being processed

SitesMasstec

Programmer
Sep 26, 2010
561
Brasil
Hello colleagues!

I created a Report which uses data from a cursor, that has about two hundred of records, selected from thousands of records from a table.

Well, the generated Report (about 25 pages) is fine.

It is acceptable that it takes about 10-20 seconds to show the report on screen. But... during these seconds, the user may think the program halted.

I know there is a class ("Thermometer") to be used during processing data. But has VFP 9 Report system some parameter to show automatically the processing ocurring? I took a look in VFP Help but I haven't found about it.

Thanks.
 
Oh sorry, Igor, the 10-20 seconds time is for both: to read/select from the table and create the cursor + for the report to be generated using the curor records.
 
You really need to determine Exactly how long it takes for the cursor to be created. Unless your report is extremely complicated and has a lot of formulas, as soon as the cursor has been created, the report should pop up nearly instantaneous. You can use Time() before Select and after and it will tell you. I bet the report takes like 2 second to pop up
 
For the report you would need a custom report listener class for the report engine. I think there is an example in the foundation classes/examples that comes with VFP9. Also, Doug Hennig has published a PDF on report listener classes that is very good.
 
Igor:

I have just tested: it took 1 second to create the cursor and 1 second to generate the report. I do not know why it is faster now.

I finished the VFP and restarted it. Also, I create EXE and executed it outside VFP environment, with changes for the selections. The result is the same now: 2 seconds to create cursor and to show the report.

Mistery... I have not changed the code.

Thank you.
 
I'll offer you some simple advice, but as a rule of thumb you should focus on speeding up queries that are taking too long by optimizing your indexes.

FoxPro generally displays the first page of reports immediately, provided the cursor was already populated, so my advice is to just place a message on the screen before you build the cursor telling something like "Please wait, this report may take several minutes to generate.", then clear the message just before calling the report itself.

If you would like it to look animated, you can create a simple form with a HTML control on it then put an image tag on it with an animated GIF of a spinning clock or something like that. The only thing you'll need to put in that control is "<img src='mygifname.gif' /> and it will display the animation... then just show the form before your query, then close it when it's populated.
 
Igor:

I have just tested: it took 1 second to create the cursor and 1 second to generate the report. I do not know why it is faster now.

I finished the VFP and restarted it. Also, I create EXE and executed it outside VFP environment, with changes for the selections. The result is the same now: 2 seconds to create cursor and to show the report.

Mistery... I have not changed the code.

Thank you.
Strange, but things like that can happen from time to time on a shared server. Sometimes servers get bogged down doing updates, backups or handling other sessions.
 

Part and Inventory Search

Sponsor

Back
Top