just using "=Parameters.myParam" as the textbox expression renders as "System.Collections.ArrayList"
Could you please advise me of the correct expression I should use?
Many thanks
13 Answers, 1 is accepted
We're already using custom user function that does that for us in the ProductLineSales catalog online example:
public static string FormatArray(ArrayList array)
{
StringBuilder sb = new StringBuilder();
foreach (object o in array)
{
if (sb.Length > 1)
{
sb.Append(", ");
}
sb.Append(o.ToString());
}
return sb.ToString();
}
Hope this helps.
Sincerely yours,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

Unfortunately passing the DisplayMember out of the box is currently not possible. Our developers are aware of this limitation and it would be addressed in a subsequent release.
What you have done - change your parameter's ValueMember to be the meaningful column and changing the filter is the easiest and most straightforward way to proceed.
If you however insist on working directly with the display member, there is a workaround. You can pass the current report item that invokes the user defined function as a parameter of the function. Then you can access the report instance using it.
Take a look at the following code snippet:
namespace ObjectDataBindungLib
{
using Telerik.Reporting;
using System.Collections;
using System.Data;
/// <summary>
/// Summary description for ReportParameterDataSource.
/// </summary>
public partial class ReportParameterDataSource : Report
{
public ReportParameterDataSource()
{
/// <summary>
/// Required for telerik Reporting designer support
/// </summary>
InitializeComponent();
// TODO: This line of code loads data into the 'categories.CategoriesTable' table. You can move, or remove it, as needed.
try
{
this.categoriesTableAdapter1.Fill(this.categories.CategoriesTable);
}
catch (System.Exception ex)
{
// An error has occurred while filling the data set. Please check the exception for more information.
System.Diagnostics.Debug.WriteLine(ex.Message);
}
// TODO: This line of code loads data into the 'productCategory.ProductCategoryTable' table. You can move, or remove it, as needed.
try
{
this.productCategoryTableAdapter1.Fill(this.productCategory.ProductCategoryTable);
}
catch (System.Exception ex)
{
// An error has occurred while filling the data set. Please check the exception for more information.
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
public static object GetLabels(object parameter, object reportItem)
{
//Access the report instance this way:
Telerik.Reporting.Processing.Report processingReport = (reportItem as Telerik.Reporting.Processing.ReportItemBase).Report;
Telerik.Reporting.Report report = processingReport.ItemDefinition as Telerik.Reporting.Report;
//Access the dataset in one of these two ways:
//ProductCategory dataset = report.ReportParameters["ProductCategoryID"].UI.AvailableValues.DataSource as ProductCategory;
ProductCategory dataset = ((ReportParameterDataSource)report).productCategory;
if (null != parameter)
{
ICollection collection = parameter as ICollection;
if (null != collection)
{
string[] labels = new string[collection.Count];
int index = 0;
foreach (object value in collection)
{
DataRow row = dataset.ProductCategoryTable.Rows.Find(value);
labels[index] = (row as ProductCategory.ProductCategoryTableRow).Name;
index++;
}
return string.Join(", ", labels);
}
}
return null;
}
}
}
use the function like this:
=GetLabels(Parameters.ProductCategoryID, ReportItem)
But there is more advanced way to have the datasource shared for the parameter and for the user defined function, and you should consider using this approach: Separate the db access logic in a new class and call it's methods that return the data you need. This way you will have your data wherever you need it.
Regards,
Steve
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

This shows the value and you mention it is something your development team is looking into. Do you have a method yet for the multi-text values?
Bob
Unfortunately the answer is no - we have not been able to work on the report parameters changes yet. However I've raised the priority of this task in our bug tracking system and we would do our best to implement it for one of the subsequent releases of the product.
Regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

How do you pass multi value paramas to sql datasource? I am trying to pass multi-value params but receive error as below. Would you please advise on how to do this or do you have an example/sample for multi-value params report somewhere that I can download? Thanks!
Failed to convert parameter value from a Object[] to a String.
------------- InnerException -------------
Object must implement IConvertible.
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.
Best wishes,
Steve
the Telerik team


public static string FormatArray(object array)
{
StringBuilder sb = new StringBuilder();
foreach (object o in (array as Array) )
{
if (sb.Length > 1)
{
sb.Append(", ");}
sb.Append(o.ToString());
}
return sb.ToString();
}
Support for out of the box mapping database parameter to multivalue report parameter was implemented in the Q2 SP1 release.
All the best,
Steve
the Telerik team

public
static
string
FormatArray(ArrayList array)
{StringBuilder sb =
new
StringBuilder();
foreach
(
object
o
in
array)
{
if
(sb.Length > 1)
{
sb.Append(
", "
);
}
sb.Append(o.ToString());
}return
sb.ToString();
}With just this:
string
.Join(
", "
, array.ToArray());

Hi, I want to find a solution:
I have created a report, using data from several dataSources. One of the dataSource needs parameter to be chosen. It works fine.
But now, I should be able to use multiselection of thit parameter. For each selected item, the whole report should be generated, then page-break and again for the next selected parameters a new one aso, each after another. So, finally, I would get a long report, which I can print at once, for mutliselected parameter.
I though to create a table, in each row I would like to put a report for one of multiselected parameters.
First my trouble is, that I can't retrive the single values of the selected parameter - I get only an object, using expression: Parameters.MyParameters.Value.
Do you have any idea for my problem?
Jola
Multivalued report parameters' values are evaluated as arrays of objects. Thus if you want to see all values in the report, you can use the Join text function as follows: =Join(',',Parameters.MyMultivalueParameter.Value)
If you need to pass such parameter to a SQL stored procedure, check my post in How pass multivalues param values to report MVC or HTML5?
Regards,
Stef
Telerik