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

ObjectDataSoruce: Design Time Parameters for object[]

5 Answers 425 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lukasz
Top achievements
Rank 1
Lukasz asked on 11 Sep 2014, 08:24 AM
Hi,

I am using Telerik for WPF, Reporting, Designer and WPF Viewer. This issue is related with Report Designer.

I have test report with a chart. Datasource is connected to my ObjectDataSource with this member signature:

List<KeyValuePair<DateTime, Decimal>> GetData(int32 year, Object[] months)

I created report parameter of type string with Multiple=True and available values as array of strings: ["Jan","Feb","Mar"....]

Everything works flawlessly except Design mode. I do not know what to pass in "Configure Design Time Parameters" dialog for months argument - when configuring ObjectDataSource.

I tried:
Jan; Feb
"Jan", "Feb"

This ones gives 
System.InvalidCastException: Invalid cast from 'System.String' to 'System.Object[]'.

=Array("Jan","Feb")
["Jan","Feb"]

This ones gives
System.Reflection.TargetInvocationException: Property accessor 'DefaultValues' on object 'Telerik.Reporting.Data.Design.ObjectDataSourceDesigner' threw the following exception:'Index was outside the bounds of the array.' ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.

And in this case I cannot even open "Configure" dialog for data source, because it throws the same exception as above and shows message box with text "Index was outside the bounds of the array."

I searched documentation and I cannot find any information how to set design time parameters for object[] ObjectDataSource arguments. Can anyone point me in right direction?



5 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 16 Sep 2014, 07:34 AM
Hello Lukasz,

This is a known issue logged in our system for improvement. Until there is a fix for the issue, please pass a single value as design-time parameter value. The design-time parameters values are used to retrieve the data schema and list the available data fields. Thus it is not required to supply the actual values.

To edit the current report, you can open its resx file and leave a single value for the months parameter, as a result the ObjectDataSource component will be configurable again.


I hope the above information is helpful.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Lukasz
Top achievements
Rank 1
answered on 16 Sep 2014, 07:42 AM
Hi,

Thanks for reply. How can I pass single value? I got System.InvalidCastException: Invalid cast from 'System.String' to 'System.Object[]' no matter what I enter and my graphs does not show in design mode.

Regards,
Łukasz



0
Stef
Telerik team
answered on 16 Sep 2014, 08:15 AM
Hello,

Please compare your settings to these of the attached report. The resx file has the following line describing the design-time parameters values used in the configuration:
Report1.resx  XML line 120:
 
<metadata name="objectDataSource1.ParameterValues" xml:space="preserve">
    <value>{year:2011},{months:Jan}</value>
  </metadata>

And below are the serialized in the Report1.Designer.cs data source component settings:
//
// objectDataSource1
//
this.objectDataSource1.DataMember = "GetData";
this.objectDataSource1.DataSource = typeof(ExportPDFWebAPI.Class1);
this.objectDataSource1.Name = "objectDataSource1";
this.objectDataSource1.Parameters.AddRange(new Telerik.Reporting.ObjectDataSourceParameter[] {
new Telerik.Reporting.ObjectDataSourceParameter("year", typeof(int), "=Parameters.year.Value"),
new Telerik.Reporting.ObjectDataSourceParameter("months", typeof(object[]), "=Parameters.months.Value")});


Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Lukasz
Top achievements
Rank 1
answered on 16 Sep 2014, 08:49 AM
I am not quite sure what Report1.Designer.cs is - I am just evaluating Reporting and do not know everything about it.
Parameters in resx file looks the same.

Anyway, I prepared test case for you and attached it to support ticket:
http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=860047

Because I cannot post zip files here.
Please open Designer from project directory and switch between design and preview modes. Preview for chart is not available in design mode exception is logged in C:\temp\Telerik.ReportDesigner.log

Regards,
Łukasz



0
Stef
Telerik team
answered on 18 Sep 2014, 03:29 PM
Hi Łukasz,

For anyone concerned, below you can find a quote from my response in the support ticket:
In the forum thread on the same topic, I gave you a solution for a report created with the integrated in Visual Studio designer. In your case the report is in XML format (TRDX file) created by the Standalone Designer.
 
Please check the attached video. The ObjectDataSource is configured properly, but the design preview would not display the Graph due to the issue I mention with multivalued parameters. The report can be previewed successfully if you set a valid default value for the report parameter.


Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Lukasz
Top achievements
Rank 1
Answers by
Stef
Telerik team
Lukasz
Top achievements
Rank 1
Share this question
or