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

SHow multi select parameter values in header

5 Answers 409 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 26 Sep 2011, 08:20 PM
I am having trouble finding any decent help or examples on how I can display Multi select parameters in a textbox in the report header.
My report has a multi select parameter filled with regions which I want to display as a comma separated list in a textbox.
I would think that this is a commonly required feature so you can display what the report is currently filtering on.
If I use the parameter value or text in the textbox it displays System.Text[]

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 29 Sep 2011, 04:28 PM
Hi Bill,

The multi-value report parameter returns an array for value. Generally arrays can be represented in different ways. Thus our suggestion is to utilize user functions. For your scenario you can use the following user function and expression:

public static string ConvertArrayToString(object[] values)
{
    var result = new StringBuilder(values[0].ToString(),values.Length);
 
    for (int i = 1; i < values.Length; i++ )
    {
        result.AppendFormat(", {0}", values[i]);
    }
    return result.ToString();
}
= ConvertArrayToString(Parameters.MyParameter.Value) Best wishes,
Peter
the Telerik team

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

0
Gerry Connolly
Top achievements
Rank 1
answered on 02 Jan 2013, 08:48 PM
Hi

I would really like to use this function but I am not sure where to put the code that creates the function.  Could you please tell where the function in created in the project. I am using VS 2012, thanks
0
Peter
Telerik team
answered on 03 Jan 2013, 09:07 AM
Hi Gerry,

As elaborated in the user functions help article, you can add user functions in the report's code behind. Select the target report and press F7 to open the reports code behind. After adding the necessary user functions, in order to list them in expression editor you have to build the project.

Regards,
Peter
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Gerry Connolly
Top achievements
Rank 1
answered on 20 Jan 2013, 09:58 PM
Hi Peter

Thanks for your reply, I have tried to add this to the code and rebuild my project but I get errors.  I attach a screenshot of where i am putting the code.  I am not a programmer so forgive me if my query is a little basic. 

Many thanks

Gerry
0
Chris Gillies
Top achievements
Rank 1
answered on 21 Jan 2013, 09:32 AM
Gerry, you're way off. The code snippet in this forum is written in C#, you're using VB. Use the code converter to get going ..
Tags
General Discussions
Asked by
Bill
Top achievements
Rank 1
Answers by
Peter
Telerik team
Gerry Connolly
Top achievements
Rank 1
Chris Gillies
Top achievements
Rank 1
Share this question
or