Okay, I know how to do this but I am running into a brick wall. So, I need a search that can look up who is off during a certain time frame. So I have a departure date and return date. So my search right now says (for example) look between 10/1/2017 -10/9/17 to see who departure date or return date falls in this date range. Well, the problem I am having is what if someones departure date is 9/31/2017 and return date 10/10/2017. So I have missed that person because they match the search HOWEVER, they were still off during that time frame so I want their info to be pulled. Hope I am clear on this.
Question
Question
Replies
The general logic for overlapping ranges is covered in this SO thread. One way to think about it is, how do 2 ranges not overlap? Only if one is entirely before the other, so A ends before B starts or vice versa. Then, since you want where they do overlap, you can negate that and apply De Morgan's Law to simplify the expression.
You should end up with Departure <= 10/9/17 AND Return >= 10/1/17.
Not sure if this will work, but give it a shot:
{[]:[DepartureDate]<="10/01/2017"} & {[]:[ReturnDate]<="10/09/2017"} | {[]:[DepartureDate]>="10/01/2017"} & {[]:[ReturnDate]>="10/09/2017"} | {[]:[DepartureDate]>="10/01/2017"} & {[]:[ReturnDate]<="10/09/2017"}
{[]:[DepartureDate<="10/01/2017"} & {[ReturnDate]:[Date]<="10/09/2017"}
This will return some trips that are completed before the desired range.
Ah, true. Good catch.
So you would really want something like:
{[]:[DepartureDate]<="10/09/2017"} | {[]:[DepartureDate]="10/09/2017"} & {[]:[ReturnDate]>="10/01/2017"} | {[]:[ReturnDate]="10/01/2017"}
Though I doubt that syntax would work...
On the right track! But there's no need for the ORs, since <= already means means less than or equal to:
{[]:[DepartureDate]<="10/09/2017"} & {[]:[ReturnDate]>="10/01/2017"}