Processing Multivalue parameters

1 Answer 44 Views
.NET Framework DataSources Expressions Report Parameters
Thato
Top achievements
Rank 1
Thato asked on 12 Sep 2023, 07:19 AM

I have a comma delimited string parameter that is parsed into a c# datasource method when a Telerik report gets rendered. When I pass the string as it is into the datasource, using Parameters.personId.Value it fails and I get an error. When I use the Join(",", Parameters.personId.Value) function, it only works if the string has a single value and it's not comma delimited. The moment I append another value to the string, it sends the parameter as an empty string to the datasource. 

This is how my data looks like:

Telerik UI parameter: 

 

C# DataSource definition: 

Sample Parameter Value: 

PersonIds: "965985,663958"

 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 14 Sep 2023, 11:20 AM

Hello Thato,

Generally, the Join Text function may be applied to arrays and, hence, to Multi-value parameters. Therefore, I assume that you use such a parameter. It returns an object[], which explains the failure when you pass it as it is as your method expected a string

I implemented locally an ObjectDataSource referencing a method like the one from the screenshot. When I passed it the parameter value '= Join(',', Parameters.MultiValue.Value)' it returned the correct data. Without the Join function, there was an error related to the type of the expected argument. When I called the data source method with a single value parameter with string value "965985,663958" the returned data set was also as expected.

If the problem persists you may consider opening a support ticket and sending a runnable report and data source project for local investigation.

Regards,
Todor
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
.NET Framework DataSources Expressions Report Parameters
Asked by
Thato
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or