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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Sending parameters to ReportWriter

Thread ID:

Created:

Updated:

Platform:

Replies:

127506 Nov 20,2016 08:01 PM UTC Sep 3,2018 06:20 AM UTC WPF 7
loading
Tags: ReportWriter
Karmen
Asked On November 20, 2016 08:01 PM UTC

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

Vinoth Srinivasan [Syncfusion]
Replied On 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. 


Karmen
Replied On 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

Vinoth Srinivasan [Syncfusion]
Replied On 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. 


abelardo silvas cortez
Replied On 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....

Mageshyadav M [Syncfusion]
Replied On 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 


abelardo silvas cortez
Replied On 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? 

Mageshyadav M [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;