We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

Sending parameters to ReportWriter

Hello!

I would like to design a RDL report and fill it with the data that I always select.

To be more precise, is it possible to send parameters or the data itself to ReportWriter (I would like to avoid using RDLC format for now), so that I can pass that parameters to queries in datasets and if so, how?

I would be glad to receive any thoughts on how to achieve this functionality.

Regards, 

Karmen Gostiša

7 Replies

VS Vinoth Srinivasan Syncfusion Team November 21, 2016 12:23 PM UTC

Hi Karmen, 
 
Thanks for contacting Syncfusion support. 
 
You can use ReportWriter’s  “SetParameters” API to specify values to the ReportParameters used in the report at code behind. Please refer to our Knowledge Base for more details on this. 
 
We have also prepared a sample with RDL report for your reference, it can be downloaded from the following location. 
 
Regards, 
Vinoth S. 



KA Karmen November 21, 2016 08:26 PM UTC

Hi!

Thank you for your helpful answer. The solution does exactly what I need. But just for the side note - there is a bug in your sample. The line reportWriter.Save(fileName, format); and lines concerning MessageBox should be below IList parameters initialization and reportWriter.SetParameters(parameters) otherwise the parameter values do not have any impact.

Regards,

Karmen Gostiša


VS Vinoth Srinivasan Syncfusion Team November 22, 2016 10:21 AM UTC

Hi Karmen, 

Sorry for the inconvenience. 

Yes, you have to set the parameter values before the Save() method in report writer to update the default parameter values. Please let us know if you require further assistance on this. 

Regards, 
Vinoth S. 



AS abelardo silvas cortez replied to Vinoth Srinivasan August 31, 2018 07:23 AM UTC

Hi Karmen, 

Sorry for the inconvenience. 

Yes, you have to set the parameter values before the Save() method in report writer to update the default parameter values. Please let us know if you require further assistance on this. 

Regards, 
Vinoth S. 


Hello
I have a problem with a reference, it flags this error "can not convert from 'System.Collections.Generic.IList <Syncfusion.JavaScript.Models.ReportViewer.ReportParameter>' to 'System.Collections.Generic.IEnumerable <Syncfusion.Reports .EJ.ReportParameter> '"
I hope someone can help me please....


MM Mageshyadav M Syncfusion Team August 31, 2018 01:18 PM UTC

Hi Abelardo, 
 
Can you confirm whether the below sample runs fine on your side, 
 
 
In the above sample, we have passed the IList to IEnumerable collection only but we didn’t get any conversion error. Please find the snippet used, 
 
                IList<ReportParameter> parameters = new List<ReportParameter>(); 
                foreach (var parameter in reportWriter.GetParameters()) 
                { 
                    ReportParameter param = new ReportParameter(); 
 
                    param.Name = parameter.Name; 
 
                    param.Values.Add("Ottawa"); 
 
                    parameters.Add(param); 
 
                } 
 
                reportWriter.SetParameters(parameters); 
 
Otherwise typecast similar to below snippet 
 
reportWriter.SetParameters(parameters as IEnumerable<ReportParameter>); 
 
Regards, 
Mageshyadav.M 



AS abelardo silvas cortez replied to Mageshyadav M August 31, 2018 03:24 PM UTC

Hi Abelardo, 
 
Can you confirm whether the below sample runs fine on your side, 
 
 
In the above sample, we have passed the IList to IEnumerable collection only but we didn’t get any conversion error. Please find the snippet used, 
 
                IList<ReportParameter> parameters = new List<ReportParameter>(); 
                foreach (var parameter in reportWriter.GetParameters()) 
                { 
                    ReportParameter param = new ReportParameter(); 
 
                    param.Name = parameter.Name; 
 
                    param.Values.Add("Ottawa"); 
 
                    parameters.Add(param); 
 
                } 
 
                reportWriter.SetParameters(parameters); 
 
Otherwise typecast similar to below snippet 
 
reportWriter.SetParameters(parameters as IEnumerable<ReportParameter>); 
 
Regards, 
Mageshyadav.M 


thanks for the reply!
I think the problem is in the type of data that does not match
Syncfusion.JavaScript.Models.ReportViewer.ReportParameter
with Syncfusion.Reports .EJ.ReportParameter
cree que sea un using? 


MM Mageshyadav M Syncfusion Team September 3, 2018 06:20 AM UTC

Hi Abelardo, 
  
Thanks for your update.  
  
Sorry for suggesting sample in WPF based on platform chosen in forum. Yes, you need to pass Syncfusion.Reports.EJ.ReportParameter only to report writer setParameter method. 
  
Hope, the issue has been resolved on your side based on proper namespace reference.  
  
Regards, 
Mageshyadav.M 


Loader.
Live Chat Icon For mobile
Up arrow icon