You are viewing limited content. For full access, please sign in.

Question

Question

Search Syntax

asked on October 27, 2017

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.

0 0

Replies

replied on October 27, 2017

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.

3 0
replied on October 27, 2017 Show version history

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"}

0 0
replied on October 27, 2017 Show version history

{[]:[DepartureDate<="10/01/2017"} & {[ReturnDate]:[Date]<="10/09/2017"}

 

This will return some trips that are completed before the desired range.

1 0
replied on October 27, 2017

Ah, true.  Good catch.

0 0
replied on October 27, 2017

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...

0 0
replied on October 27, 2017

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"}

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.