Hi, we are developing a asp.net mvc application and we are using the Telerik Reporting and HTML5 Viewer (and javascript). Everything works fine when we use our "trdp" or "trdx" report files on the file system and we get the report on the page access a database and showing some data.
Now, we are changing how we store the files on the system and we are going to a cloud storage environtment where all files will be on the cloud, including the trpd report files. It also could be stored on the database. We are using the InstanceReportSource to get the report object as byte array (from cloud or database) like this:
// get the stream for trdp report file
var reportStream = GetReportStreamFromCloud(...);
var reportDocument = (Telerik.Reporting.Report) reportPackager.UnpackageDocument(reportStream);
// check for subReports to replace it dynamically (code bellow here..)
var instanceReport =
new
InstanceReportSource() {ReportDocument = reportDocument};
return
instanceReport;
It works fine when it is a simple report without subReports. The problem is when we have subReports and we try to set it dynamically as a byte array using InstanceReportSource and this SubReport has parameters (independently if it comes from main Data Source or from main Report Parameters). The code bellow is how we set the subReport:
foreach
(var sections
in
reportDocument.Items.Where(x => x
is
DetailSection || x
is
GroupSection))
{
foreach
(var item
in
sections.Items.Where(x => x
is
SubReport))
{
var subReport = (SubReport) item;
// get the Stream for trdp subreport file.
var subReportStream = GetReportStreamFromCloud(...);
// unpack the report Stream
var subReportDocument = (Telerik.Reporting.Report) reportPackager.UnpackageDocument(subReportStream);
var instanceSubReport =
new
InstanceReportSource() {ReportDocument = subReportDocument};
subReport.ReportSource = instanceSubReport;
}
}
How can we pass the parameters to the subReport dynamically?
Thank you.