Report Generation Status
pinbot
Texas
I have a web form that generates a report on the fly. Sometimes the report can be 2000 pages so it can take a little while.
I fire up a background thread to actually create the report. I use a semaphor to let the foreground thread know when the report is completed.
With an asp:timer control I update the web page every 2 seconds to let the user know the report is still being generated. When it is done, I change the status message to a link to the newly created and pdf exported report.
And everything works great.
Is there a way to get the number of pages already completed while the report is being "prepared"?
I'd like the status message to be something like "Your report is being generated. xxx pages so far completed." until the report is done.
Thanks,
Bryan
Comments
You may use progress events:
What is the scope of "Config"?
I'm using this outside of the report scripting.
In my ASP.Net web page Page_Load I use:
FastReport.Utils.Config.WebMode = true;
FastReport.Report Rpt = new FastReport.Report();
Rpt.Load(this.Page.Server.MapPath("../App_Data/PropSheets.Frx"));
if (Session["QuerySQL"]!=null)
{ sql=Session["QuerySQL"].ToString();
FastReport.Data.TableDataSource tds = (FastReport.Data.TableDataSource) Rpt.GetDataSource("Query1");
tds.SelectCommand = sql;
}
Rpt.Prepare();
Thanks. I should have seen my "FastReports.Utils.Config.Webmode"....
I have this in my thread.
FastReport.Utils.Config.WebMode = true;
FastReport.Utils.Config.ReportSettings.Progress += new ProgressEventHandler(ReportSettings_Progress);
And
private void ReportSettings_Progress(object sender, ProgressEventArgs e)
{
Debug.WriteLine("Progress: " + e.Progress.ToString());
}
And it does not seem to get called.
Do I need to do anything else?
hmm.
I even tried:
FastReport.Utils.Config.ReportSettings.Progress += new ProgressEventHandler(this.ReportSettings_Progress);
To point to the local instance of my event handler.
Does my event handler have to be in the FastReports namespace?
That was it.
Thanks!
I noticed that when printing the report, the progress event is called twice for each page.
I've attached a picture of the progress page. Looks much nicer showing how many pages have been generated. This report can be anywhere from 1 page to 2500 depending on the search criteria.
Do you know if this will work in FastReports 4.0??
I have been looking all over to find someway to insert a progress bar in my reports, but with no success.
I am really no programming expert, so any help whatsoever would be great!
Thank you
Alex