This is a migrated thread and some comments may be shown as answers.

bind data to the report

3 Answers 92 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Million
Top achievements
Rank 1
Michael Million asked on 13 Nov 2010, 02:38 AM
Hi,

Is there any way to know when the data processing gets complete? In other words, I would like to know when the report has completed binding its data.

Thanks

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 15 Nov 2010, 05:46 PM
Hello Michael,

The Report Life Cycle and Understanding Events help articles cover this matter. Please review them and let us know if further help is needed.

Sincerely yours,
Steve
the Telerik team
See What's New in Telerik Reporting in Q3 2010 on Wednesday, November 17, 11am Eastern Time: Register here>>
0
Michael Million
Top achievements
Rank 1
answered on 16 Nov 2010, 03:59 AM
Steve,

Thank you for getting back.

I should have included more description of what I'm trying to do.

I have a report container with numerous sub-reports in it.  I want to run the report and then save as a pdf.

My code is something like:
..

 

Logger.Write("PersistReportToFile starting", Trace);

 

Telerik.Reporting.

IReportDocument currentReport = reportViewer1.Report;

 

 


if
(currentReport == null)

 

{

 

    Logger.Write("nulll!", Error);

 

 

}

 

 

// Set current report parameters to parameters supplied on the command line

 

 

List<Telerik.Reporting.ReportParameter> rp = currentReport.ReportParameters.ToList<Telerik.Reporting.ReportParameter>();

 

rp[0].Value = (

DateTime) e.Data.Parameters["StartDate"];

 

rp[1].Value = (

DateTime)e.Data.Parameters["EndDate"];

 

reportViewer1.RefreshReport();

SaveReport( currentReport, (

string)e.Data.Parameters["FileName"]);

 


=================================================

The issue is that many times the resultant PDF just contains the labels preceding each sub-report.  It's like none of the sub-reports executed.

But, if I add a sleep to the above code, it works.

....

reportViewer1.RefreshReport();

Thread.Sleep(60*1000);

SaveReport( currentReport, (string)e.Data.Parameters["FileName"]);
...

 


So, it would appear that I need to wait a little longer before calling savereport.???

Any ideas?  in addition, we've verified all report parameters are being set correctly.

savereport is as follows:

 

public void SaveReport(Telerik.Reporting.IReportDocument report, string absoluteFileName)

 

{

 

ReportProcessor reportProcessor = new ReportProcessor();

 

 

RenderingResult result = null;

 

 

Logger.Write("reportProcessor.RenderReport", Trace);

 

 

try

 

{

result = reportProcessor.RenderReport(

"PDF", report, null);

 

}

 

catch(Exception ex )

 

{

 

Logger.Write("reportProcessor.RenderReport:" + ex.ToString(), Error);

 

}

 

if (result != null)

 

{

 

using (FileStream fs = new FileStream(absoluteFileName, FileMode.Create))

 

{

fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);

fs.Close();

}

}

}

// end of SaveReport()

 



Thanks,
Michael
0
Steve
Telerik team
answered on 19 Nov 2010, 04:40 PM
Hi Michael,

Thank you for the thorough description. However we were not able to reproduce such problem and the very fact it works with a sleep is most interesting. Please open a support ticket and attach a sample runnable report showing the problem, so we can review it locally and advise you.
P.S. Is there any specific reason to use SubReports for this scenario. We believe that the Report Book functionality would work better for such case.

Sincerely yours,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
Michael Million
Top achievements
Rank 1
Answers by
Steve
Telerik team
Michael Million
Top achievements
Rank 1
Share this question
or