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

InstanceReportSource deprecated

2 Answers 207 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 04 Jan 2017, 10:11 AM

Hello, I noted that InstanceReportSource is now deprecated, what is wrong with instance report source?

Anyway, how can I replace this code that does not know anything about report parameters?

Looks like the TypeReportSource does not fills the parameters set, so that code should get parameters informations elsewhere?

string ReportLibrary = oRepLib.ToString();
string ReportName = oRepName.ToString();
 
Telerik.Reporting.Report report = WorkerWrapper.getTelerikReporting(ReportLibrary, ReportName);
foreach (var p in report.ReportParameters)
{
    object oParam ;
    if(!spoolRequest.TryGetParameter(p.Name, out oParam))
    {
        if(p.AllowNull == false)
            throw new InvalidOperationException("The parameter " +  p.Name + " is not optional on report " + ReportLibrary + "." + ReportName);                   
    }
 
    p.Value = oParam;
}
 
Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
 
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
 
Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
 
             
reportSource.ReportDocument = report;           
 
Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);

2 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 05 Jan 2017, 10:48 AM
Hi Andrea,

The InstanceReportSource is not recommended for usage when you set a ReportSource for a SubReport, NavigateToReportAction in a Report Designer - this creates an additional report instance in the report that has to be maintained. Also the InstanceReportSource requires manual handling if the report will be displayed via Telerik Reporting Service e.g. How to display a report via InstanceReportSource in the HTML5 Viewer.

In your case, you are executing server-side code exporting programmatically a report, and the InstanceReportSource can be used without issues.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Andrea
Top achievements
Rank 1
answered on 04 Feb 2017, 09:04 AM

I was thinking i already marked your as the answer.

Ok good so in our case I can continue using instance report source.

 

Best regards

Tags
General Discussions
Asked by
Andrea
Top achievements
Rank 1
Answers by
Stef
Telerik team
Andrea
Top achievements
Rank 1
Share this question
or