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

Optional Filters in Telerik Reporting

2 Answers 568 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kailash
Top achievements
Rank 1
Kailash asked on 17 Apr 2012, 03:18 PM
Hello All,

I am using Telerik Reporting Control.
I want to  make all Reporting Filters as optional.

The filter can be DateTime / String / Bool / Integer or anything else.
After browsing few of the forums i Set AllowBlank and AllowNull properties to True for all filters.
(I know the AllowBlank = True is only valid in case of String Type.. But still i Set it for all types for testing)

But still it is not giving the desired results.

What i want exactly is to show All Report Data by default if no filter value has been assigned.
It works fine if there is only String type filters are provided. But if i add DateTime Filter (DateTime or Nullable DateTime)
it won't show the results..
Is it possible to show unfiltered Data on report ???

I also Set the Default Value to Null but still no results.

Can anybody help..

Thanks in Advance

2 Answers, 1 is accepted

Sort by
0
Accepted
Petio Petkov
Telerik team
answered on 18 Apr 2012, 05:01 PM
Hi,

First of all, you should set AllowNull=true to all ReportParameters with Type=DateTime.

After that you could add report filters(Please check the attached screenshot). E.g.
Expression: =Fields.ModifiedDate >= Parameters.startDate.Value OR Parameters.startDate.Value is null
Operator: =
Value: =True

In case that the suggestion above doesn't fit, you could change the query you're using, E.g.
If you have something like the following one:

SELECT         ModifiedDate
FROM            Production.ProductPhoto
WHERE  ModifiedDate between @startDate and @endDate
Change it to:
SELECT         ModifiedDate
FROM            Production.ProductPhoto
WHERE (ModifiedDate >= @startDate or @startDate is NULL) and
(ModifiedDate <= @endDate or @endDate is NULL)

Let us know if you have any other questions.
Regards,
Petio Petkov
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
Kailash
Top achievements
Rank 1
answered on 19 Apr 2012, 09:41 AM
Thank you Petio

I was too working on the Experssions to get the desired output and got some idea how to deal with it.
But off course your solution provided me a correct path to implement it.
In fact i want to make it work for Integer and Float Values as well..
Thanks Alot.
KD

Tags
General Discussions
Asked by
Kailash
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Kailash
Top achievements
Rank 1
Share this question
or