Hello guys.
We are storing the TRDX files in the Windows Azure Cloud Storage in a Asp.Net MVC application. Given the *.trdx files are not on the disk, we need to verify at runtime (in a class that implements IReportResolver) if the report has a subreport. If it has, we try to get the trdx (xml content) an set the reportSource of a subReport as a XmlReportSource. Actually, we need to replace a UriReportSource to a XmlReportSource. It works when we do not have parameter, but does not work when we have parameters. Look at the code bellow:
// find a detail section and a subReport on it.
foreach
(var section
in
reportInstance.Items.Where(i => i
is
DetailSection))
foreach
(var item
in
section.Items.Where(i => i
is
SubReport))
{
var subReport = (SubReport) item;
// if the subReport is an UriReportSource
if
(subReport.ReportSource
is
UriReportSource)
{
// we try to convert the UriReportSource to XmlReportSource
var subReportUriSource = (UriReportSource) subReport.ReportSource;
// get an object that represents a report in our system
var subReportViewModel = reportService.GetSubReportFileName(reportId, subReportUriSource.Uri);
// create an instance of our helper to get the content from the windows azure cloud storage
var storage = CloudStorageFactory.Create();
// get the xml content
var xmlContent = storage.GetContent(subReportViewModel.FileName);
// create a XmlReportSource with the xmlContent
var xmlReportSource =
new
XmlReportSource() {Xml = xmlContent};
// set the parameters
foreach
(var parameter
in
subReportUriSource.Parameters)
xmlReportSource.Parameters.Add(parameter);
// set on the ReportSource
subReport.ReportSource = xmlReportSource;
}
}
I am not sure if I can do it at runtime, or what I am doing wrong but it is giving an error like this:
Internal Server Error:
An error has occurred while processing the report. Processing canceled. Check the InnerException for more information.Invalid value of report parameter 'PersonID'.
Does anybody know what I can try?