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

Parsing multivalue parameter selection for display in header

1 Answer 189 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Robert Yexley
Top achievements
Rank 1
Robert Yexley asked on 12 Apr 2010, 10:11 PM
I have a report that has a couple of multivalue parameters on it, and I need to be able to display the value of the parameter selection on the report header according to the following rule: If only one of the values is selected, display the selected value, if multiple values are selected, display the word "multiple". So for example, if the parameter is called "Change type" and has three values (1, 2 and 3) with display values of "Added", "Modified" and "Deleted", when only value 1 is selected, in the header I need to display "Change type: Added". But if multiple or all values are selected, I need to be able to display "Change type: Multiple".

In order to parse the selected values of the parameters, I've created a textbox in the report header to handle displaying this text, and have created a custom method that gets called from the Report_ItemDataBound event handler. In this custom method, I'm having trouble figuring out how to evaluate the selection of the named parameter to determine if multiple values have been selected or not. I was hoping someone could point me in the right direction for how to do this. I'm also open to hearing if there's a better way to accomplish this if there is one.

Thanks for the help.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 15 Apr 2010, 05:55 PM
Hello Robert Yexley,

At runtime you can access the report parameters through the Report..::.Parameters dictionary. Each Parameter object contains resolved available values, current value and label.
Check out the code snippet bellow it shows how to accomplish your requirement:

private void Report_ItemDataBound(object sender, EventArgs e)
{
    var processingReport = (sender as Telerik.Reporting.Processing.Report);
 
    var processingTextBox = (Telerik.Reporting.Processing.TextBox)processingReport.ChildElements.Find("reportHeader", true)[0];
 
    Object[] o = (Object[])ReportParameters[0].Value;
 
    if (o.Length > 1)
    {
        processingTextBox.Value = "Multiple";
    }
    else
    {
 
        processingTextBox.Value = o[0].ToString();
    }
}


Regards,
Peter
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.
Tags
General Discussions
Asked by
Robert Yexley
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or