Multiple range filters on a string type field breaks date range filter

81 Views Asked by At

My report pulls Jobs and subcontracts for those jobs. I am filtering with a parameter for the subcontract origination date as ?BegDate and ?EndDate. This works just fine until… Then I need to filter the results to only include jobs that are from 10000 to 19900 and 50000 to 59000, Job is a String field but the data in it looks like this “10000-“ notice the dash at the end of the number, I have to include that dash or the filter doesn’t work but that isn’t the problem. Anyway, if I just filter for the date range and one of the job ranges all is great. When I add the second job range filter it breaks the date range filter.

Here is my filter:

This works:

{JCJM.Job} in "10000-" to "19000-" and
{SLHDPM.OrigDate} in {?BegDate} to {?EndDate}

This breaks the date filter (results ignore the date filter completely):

{JCJM.Job} in "10000-" to "19000-" or
{JCJM.Job} in "50000-" to "59000-" and
{SLHDPM.OrigDate} in {?BegDate} to {?EndDate}
1

There are 1 best solutions below

0
On BEST ANSWER

So I got the answer from an instructor I had and here it is for anyone else:

There’s an order of precedence issue going on between the “or” operator and the “and” operator in the record selection formula.

Normally you will want to enclose the job ranges (and the “or” operator) in parenthesis. But when you’re using the “in range” operator, you can combine two or more sets of ranges by enclosing the values in square brackets. This replaces the need for the “or” operator between the job ranges , like this:

{JCJM.Job} in ["10000-" to "19000-", "50000-" to "59000-"]
and
{SLHDPM.OrigDate} in {?BegDate} to {?EndDate}