Is there a way to setup optional parameters using telerik reporting?
I have a report that could potentially contain a large amount of data so I do not want to use filters if possible.
Ideally I'd like to define several parameters such as start start date and end date. If a user enters start date it returns everying greater than oir equal to that date, the end date returns everything less than or equal to it OR I could enter both dates and return all dates within the range. Theactual report is quite complicated and there will be more parameters but the general principle applies.
I have a report that could potentially contain a large amount of data so I do not want to use filters if possible.
Ideally I'd like to define several parameters such as start start date and end date. If a user enters start date it returns everying greater than oir equal to that date, the end date returns everything less than or equal to it OR I could enter both dates and return all dates within the range. Theactual report is quite complicated and there will be more parameters but the general principle applies.
4 Answers, 1 is accepted
0
Hello Mike,
You would need filters either way if you want your users to be able to limit the data according to start and end date. According to your description the trick is to still be able to display all of the data when there is no start and end dates selected (no initial value). For this purpose we're going to use the AllowNull property of the report parameters and in the filter expressions check for null value with the built-in IsNull function and if it is null, return desired value i.e. DateTime.MaxValue or DateTime.MinValue depending on whether it is a start or end date via user function. I've attached a sample report that shows this approach, you would need the AdventureWorks database in order to run it.
Greetings,
Steve
the Telerik team
You would need filters either way if you want your users to be able to limit the data according to start and end date. According to your description the trick is to still be able to display all of the data when there is no start and end dates selected (no initial value). For this purpose we're going to use the AllowNull property of the report parameters and in the filter expressions check for null value with the built-in IsNull function and if it is null, return desired value i.e. DateTime.MaxValue or DateTime.MinValue depending on whether it is a start or end date via user function. I've attached a sample report that shows this approach, you would need the AdventureWorks database in order to run it.
Greetings,
Steve
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
0
Mike
Top achievements
Rank 1
answered on 21 May 2012, 01:29 PM
Thanks. I'll give it a go.
0
Andrew
Top achievements
Rank 1
answered on 08 Oct 2012, 06:11 AM
I tried this solution and working when I ran the site via vs 2010.
When I uploaded the site to my production environment the filter would not work.
The report showed up with just the static headers but no data.
When I changed the filter back to just the report parameter the filter started working, but only when the parameters was selected. I do not have the ability to select all the items in the report.
MTmace
When I uploaded the site to my production environment the filter would not work.
The report showed up with just the static headers but no data.
When I changed the filter back to just the report parameter the filter started working, but only when the parameters was selected. I do not have the ability to select all the items in the report.
MTmace
0
Hi Andrew,
The example runs correctly in our local tests and it should not matter where it is deployed to. Maybe it is a problem with the reporting version you're using? Please check whether you have deployed your application 1:1 as in your local machine and you should not encounter such weird behavior.
All the best,
Steve
the Telerik team
The example runs correctly in our local tests and it should not matter where it is deployed to. Maybe it is a problem with the reporting version you're using? Please check whether you have deployed your application 1:1 as in your local machine and you should not encounter such weird behavior.
All the best,
Steve
the Telerik team
HAPPY WITH TELERIK 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!