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

Parameters in Reporting

3 Answers 164 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike Lumpp
Top achievements
Rank 1
Mike Lumpp asked on 06 Oct 2009, 03:57 AM
Hey all,

I've managed to get this far, and could just use a nudge in the right direction if possible:

I wanted to select values from my database, have my business object return them in a collection (generic) and then create parameters in a dropdownlist at the top of the report, so a user can select an item at the top. Subsequently, this item would go out to a stored procedure, that would get different results on the page (i'm actually using a graph on the chart/report)

List

 

<string> campaignTypes = ReportGenerator.GetCampaignTypes(parameters/metadata goes here..);

 

 

 int i = 0;

 

 

foreach (string campaignType in campaignTypes)

 

{

 

  ReportParameter rp = new ReportParameter(campaignType, ReportParameterType.String, campaignType);

 

 

  this.ReportParameters.Add(rp);

 

 

  this.Report.ReportParameters[i].UI.Text = campaignType;

 

 

  this.Report.ReportParameters[i].UI.Visible = true;

 

   i = i + 1;

}

So the area in green..this goes ahead and adds 3 parameters (i had 3 items in the list), but the problem is they are all new parameters in textboxes! I wanted to have 3 in one report parameter collection, as a dropdownlist.

I understand there is a reportparametercollection, but I did not see a way to add it to the report. Only to create it and add report items to it. This code is in the constructor of my report, by the way. Any suggestions on how to get the dropdownlist to appear, and have it's datasource as the generic?

Thanks so much!

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 06 Oct 2009, 03:46 PM
Hello Mike,

If you're aiming for a single parameter with multiple values, then you need a multivalue parameter. You can learn more about that from the latter link and this blog post.
More info on passing report parameter to a stored procedure param is available in this KB article:  Using data source with parameters in Telerik Reporting.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mike Lumpp
Top achievements
Rank 1
answered on 07 Oct 2009, 11:12 PM
OK I was able to solve this; What I was trying to do was bind the report parameter to a .net List of <String>. You can't set the DataSource property of the parameter to something like that (primitive types). So I went ahead, modified my business object, and made it return an actual object rather than a string.. hard to explain but quite simple, really.

I set the datasource to that list of objects, then set the ValueMember/DisplayMember and all worked!

Thanks for helping! BTW that KB article you provided for my next step (passing the selected parameter to something) did not work/was broken, but I was able to just do this.ReportParameters[0].Value and get the selected parameter..

Is there a way, however, to have the report parameter "postback" ? What I want is when the user selects parameter 1, i want a new dropdownlist to appear where they can select parameter2 (based on what was selected from parameter 2) a la jquery or sometimes referred to as 'daisey chaining'.

..Presumably I'd just need to tell my page to "post back" but haven't figured out how yet :)

Thanks!

Mike

 

0
Steve
Telerik team
answered on 08 Oct 2009, 03:34 PM
Hi Mike,

We're glad that you were able to figure your issue out. We’ve made reorganization of the reporting KB section and that is why the URL of the KB is no longer valid. Till yesterday all articles were under a single “General” category, while now they are organized in separate categories depending on their content. Our advise is to go to KB main page (http://www.telerik.com/support/kb/reporting.aspx) where you would see ALL KB articles by default. From the right hand side pane, you can navigate to a specific category and locate whatever KB article you’re looking for. Specifically the KB article from my previous post is available here: Using data source with parameters in Telerik Reporting.
The answer to your second question is no. There are no exposed events for the parameters area and we do not have plans for introducing such. The built-in parameters are meant to provide you with basic means to work with the report filter and handle report parameters. For more complicated scenarios, you should create a custom UI and wire it up with the report parameters through the Report API.
Your scenario is also known as "cascading parameters" and you can see such example in our Product Line Sales demo report. The only downside is that the second parameter would be always visible and not appear on demand as you've described.

All the best,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Mike Lumpp
Top achievements
Rank 1
Answers by
Steve
Telerik team
Mike Lumpp
Top achievements
Rank 1
Share this question
or