This is a migrated thread and some comments may be shown as answers.

Migrating from IReportDocument.ReportParameters to ReportSource.Parameters

3 Answers 19 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
erwin
Top achievements
Rank 1
Veteran
erwin asked on 05 Mar 2017, 06:57 PM

Hi,

I could not find a pointer on how to migrate to ReportSource.Parameters for Parameters with predefined values. In my WinForms application I use ReportParameter.AvailableValues. I found that Report.Parameters class has AvailableValues but not ReportSource.Parameters. Somehow I can't make the connection between the parameters defined in the report source and the definition of parameters during processing.

Is there an example for migrating existing code that uses IReportDocument.Parameters with AvailableValues.

Regards

Erwin

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 08 Mar 2017, 03:51 PM
Hi Erwin,

A Telerik report has ReportParameters collection that contains all parameters you added for that report. In a report you can configure report parameters to be visible or to have default value, or to have available values - Report Parameters. Note that available values for a report parameter can be set only through the report's ReportParameters collection and the corresponding parameter.

Once a report is designed and you want to display it or process it without preview, you need a ReportSource object. The purpose of report sources is to let you specify the report, where the report can be in different format (XML or its compressed version saved in a TRDP file, dynamically created instance, report designed in VS Report Designer) -  Report Sources. The ReportSource object has a Parameters collection, where the ReportSource.Parameters collection is mapped by key (Name) to the report's ReportParameters collection. The purpose of the ReportSource.Parameters collection is to pass values (set their Value properties) to the report parameters.


In order to provide you more accurate suggestions, please elaborate on the scenario, the used Telerik Reporting viewer and version.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Accepted
erwin
Top achievements
Rank 1
Veteran
answered on 08 Mar 2017, 05:31 PM

Hi Stef,

I'm working with the latest and greatest Release (2017.1 SP1)

thanks for your explanation. The problem was that I had a Method setting the report parameters which took an IReportDocument 

 

private bool SetReportParameters(IReportDocument src)
{

 

which triggered

WarningCS0618'IReportDocument.ReportParameters' is obsolete: 'The ReportParameters property is now obsolete. Please, use instead the ReportSource.ReportParameters.

 

In fact the argument on the calling side was already a Report object. So all I had to to was change the Signature of the function to 

private bool SetReportParameters(Report src)
{

 

The error message is maybe a bit misleading, because it does not mention the Report.ReportParameters collection which is what might be intended.

Thanks and kind Regards

ERwin


 

0
Stef
Telerik team
answered on 09 Mar 2017, 04:57 PM
Hi Erwin,

The warning message needs correction and the task is logged for improvement. Your Telerik points are updated to thank you for bringing the issue to our attention.

Thank you once again for the feedback.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
erwin
Top achievements
Rank 1
Veteran
Answers by
Stef
Telerik team
erwin
Top achievements
Rank 1
Veteran
Share this question
or