|
Query |
Response | |
|
The report has 2 string parameters that do not accept nulls. Each parameter has a default value in the report definition. Question: do I still need to supply a value for each parameter, and if so, do I do as per this article: "https://www.syncfusion.com/kb/7050/how-to-set-parameter-to-reportwriter"?
|
If you have specified default values for the parameter in report itself, then no need to pass the default values to the parameter from code behind. | |
|
The report has many subreports. Do I need to supply a value for the DataSourceCredentials of the subreports? If so, how do I do that? Please provide documentation. |
Yes, you have to specify the datasource credential for the subreport in “OnInitReportOptions” in your WebAPI controller. Please refer the below code snippet.
We have prepared a sample based on this and it can be downloaded from the below location
|
I have inserted the code to set the subreport datasource on the Web API controller, and I am still having the issue (the report comes back blank, no error or exceptions are thrown). In my case, the "reportOption.SubreportModel" property is always null, so I instantiated it in the "OnInitReportOptions" method in the Web API report controller (see code below). Please provide additional troubleshooting steps, or let me know if I need to provide additional technical details.
//update subreport
if (reportOption.SubReportModel == null)
{
reportOption.SubReportModel = new SubReportModel();
}
reportOption.SubReportModel.DataSourceCredentials = new List<Syncfusion.Reports.EJ.DataSourceCredentials>();
reportOption.SubReportModel.DataSourceCredentials.Add(new Syncfusion.Reports.EJ.DataSourceCredentials(reportDatasourceName, reportDatasourceUserName, reportDatasourcePassword));
|
if (reportOption.SubReportModel != null)
{
reportOption.SubReportModel.DataSourceCredentials = new List<Syncfusion.Reports.EJ.DataSourceCredentials>();
reportOption.SubReportModel.DataSourceCredentials.Add(new Syncfusion.Reports.EJ.DataSourceCredentials(reportDatasourceName, reportDatasourceUserName, reportDatasourcePassword));
} |
Vinoth, I have placed the code snippit in the "OnInitReportOptions" controller method as you suggested, and I am still unable to run the report (it comes back completely blank).
I put a breakpoint within the "If" block, and it never gets hit. So, the "reportOption.SubReportModel" property is always null, even though the report I am trying to run has several subreports.
Please let me know what additional steps I can take to troubleshoot the report. We will have a lot of report with subreports that we will need to preview.
Hi Vinoth, I have attached the RDL file for the report for you to look at. By the way, I was mistaken when I said the the report has several subreports. The report does not have any subreports. It does have two parameters and several datasets.