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

ObjectDataSource and MultiValue Parameter

10 Answers 481 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ulrich
Top achievements
Rank 1
Ulrich asked on 25 Aug 2010, 03:53 PM
Hello,

I have a (hopefully) easy question/problem:

I am using an objectdatasource to populate a Telerik Report. This is working fine. Now I want to change one of the parameters of the select function in the DataSource to accept a multi-value parameter (multiple ints), but regardless what I try as type (object, object[], int[]), I always get the error that the following error during creation of the report:

An error has occured while processing Table 'crosstab1':
An error has occured while resolving 'MyObjectSource' data source: Ein Objekt muss IConvertible implementieren.
The last error translates to "an object has to implement IConvertible".

I even changed the parameter of the function in the objectdatasource to type IConvertible, with no luck.

What am I doing wrong to get multivalue parameters to work?

BTW: I am still at Q1 2010 release and have not yet updated to Q2

best regards

Ulrik

10 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 31 Aug 2010, 11:57 AM
Hi Ulrich,

The DataSource Components don't work out of the box with a MultiValue Report Parameter since the current implementation is based on ADO.NET and does not allow you to pass a collection of values (set, array). Thus, the SqlDataSourceParameter accepts only single values corresponding to the SqlDataSourceParameter.DbType property. Although this is a known limitation of ADO.NET and not a problem of our product, we're currently working on possible solution for it and it would be part of the upcoming Q2 SP1.

Regards,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
steve
Top achievements
Rank 1
answered on 21 Feb 2011, 01:51 PM
Hello Steve,

has this problem been solved now? If so, how should the signature of business object's method look like? (I am using Q3 2010)
0
Steve
Telerik team
answered on 24 Feb 2011, 01:19 PM
Hi Steve,

Such scenario would work automatically since the latest Q2 SP1 2010 release, namely the following item: Fixed: SqlDataSource cannot map database parameter to multivalue report parameter.

Best wishes,
Steve
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
steve
Top achievements
Rank 1
answered on 18 Mar 2011, 02:26 PM
Hi Steve,

thank you for your response, but I still don't know how the signature of the business object's method should look like. I have a report parameter "ids" which has the MultiValue flag set to true, and the Type set to Int. Now I want to bind the value of this parameter to a business object's method's parameter. I have tried these signatures, but either didn't work for me (the same exception as in the first post):

class BusinessObject {
  GetItems(int[] idsBusiness) { ... }
  GetIetms(object[] idsBusiness) { ... }
  GetItems(object idsBusiness) { ... }
}
Which type of the parameter idsBusiness should I use in order to bind the report's parameter "ids" to it?

P.S.: I am using Q3 2010
0
Michael
Top achievements
Rank 1
answered on 16 May 2011, 09:38 PM
I'm using the latest, but with MySql and an ObjectDatasource and I get the "IConvertable" error. How do I do a multi-value to an "In"?
0
Roy Halvorsen
Top achievements
Rank 1
answered on 23 Sep 2011, 07:29 AM
Hi. I am having the same problem/question as described above.

My report is using an ObjectDataSource with the following datamember:

public static Collection<ReportCommonMatrixDataContract> GetSmokingStatusReport(DateTime fromDate, DateTime toDate, string schemaType, int? fromAge, int? toAge, string gender)

This works fine when the parameter "gender" is a normal dropdown. When I turn on multivalue for this parameter I get the following error:

An error has occurred while resolving 'objectDataSource1' data source: Object must implement IConvertible.

What type should my datamember "gender" be to make this work?

Regards, Roy
0
Steve
Telerik team
answered on 27 Sep 2011, 08:12 AM
Hello Roy,

You get this error because multi-value parameters pass their values as object[], but the corresponding arguments of your method are not arrays. There is no automatic conversion between object[] and regular type (e.g. string) - hence the error. To correct this, declare your argument as object[] instead, and convert it to a string[] or whatever your correct type is programmatically in the method body if necessary.

Best wishes,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Roy Halvorsen
Top achievements
Rank 1
answered on 04 Oct 2011, 01:11 PM
Thanks, this works fine.

I am having the same problem with my nullable integer parameters fromAge and toAge. It works fine when the parameters are set to null, but when they have a value for instance 10, then I get the error:
 
An error has occurred while processing Chart 'chart1':
Specified cast is not valid.

Any idea why?

Regards,

Roy
0
Steve
Telerik team
answered on 05 Oct 2011, 03:26 PM
Hi Roy Halvorsen,

We cannot say for certain what is the problem without looking into a runnable project. Verify that the database field is integer and if you have any data conversions in chart build methods - make sure they are correct.

Kind regards,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Roy Halvorsen
Top achievements
Rank 1
answered on 07 Oct 2011, 07:55 AM
Hi again.

I figured out what was the problem when sending a nullable int to my method.

For some reason I have to convert the paramter to an Int like this:

Convert.ToInt32(Report.ReportParameters[3].Value)

A bit strange that a parameter declared as a nullable int is in fact not an int, but nevermind it works now.

Roy
Tags
General Discussions
Asked by
Ulrich
Top achievements
Rank 1
Answers by
Steve
Telerik team
steve
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Roy Halvorsen
Top achievements
Rank 1
Share this question
or