Filter using OR instead of AND.

1 Answer 239 Views
Filtering General Discussions Report Designer (standalone) Report Parameters
Michael
Top achievements
Rank 1
Iron
Iron
Michael asked on 28 Mar 2022, 07:40 PM | edited on 28 Mar 2022, 07:41 PM

I have 3 report parameters. 

Fields.InvYear,

Fields.InvMonth,

Fields.InvQtr

I have 3 corresponding filters:

= Fields.InvYear = = Parameters.Year.Value

= Fields.InvMonth = = Parameters.Month.Value

= Fields.InvQtr = = Parameters.Quarter.Value

The year parameter is required, however I want the user to be able to pick either Month or Quarter. Even if I allow NULL or blank on the Month or Quarter parameters, Telerik says the parameters are required. The filters are hard coded to be AND, which should not make a difference if one of the parameters is blank. How do I create a "blank" entry?

My SQL fields:

DATENAME(YEAR, Invoice.DateCreated) AS InvYear,
DATENAME(MONTH, Invoice.DateCreated) AS InvMonth,
DATENAME(QUARTER, Invoice.DateCreated) AS InvQtr,
Michael
Top achievements
Rank 1
Iron
Iron
commented on 29 Mar 2022, 01:33 PM

I solved this issue by just making the month multi-select, which is a work-around. I would still like to know how to use an OR between report parameters versus AND.

1 Answer, 1 is accepted

Sort by
1
Accepted
Todor
Telerik team
answered on 31 Mar 2022, 09:06 AM

Hi Michael,

Indeed, you may combine the filtering Expression only with the 'And' operator. The reason is that it is not clear what would be the precedence if we had both 'And' and 'Or' operators.

The workaround is to utilize a single Expression. For example:

Expression																	|	Operator	|	Value
=(Fields.InvQtr = Parameters.Quarter.Value) Or (Fields.InvMonth = Parameters.Month.Value)	|	=		|	=True

Regards,
Todor
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Tags
Filtering General Discussions Report Designer (standalone) Report Parameters
Asked by
Michael
Top achievements
Rank 1
Iron
Iron
Answers by
Todor
Telerik team
Share this question
or