Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
chasafd
Contributor II
Contributor II

Need to compare each row to all others in selection

I have a data set that looks like this:
   Event ID, start datetime, end datetime  (stored as # minutes since fixed starting point)
   Sorted by start datetime
   For each record, I need to determine if any other records in the selection overlap the interval
  
   s0<----------->e0
                               s1<----------->e1
                                           s2<---------->e2
                                                                         s3<----------->e3
            
I created a bar chart using "bar offset" to see this visually.  I need to flag (or color code) Events 1 and 2 as having an overlap. Events 0 and 3 are left unmarked.  I need to do this in an expression and not the script so it works based on selections.  (Specifically, these events are fire department incidents, and we may want to select multiple stations looking for overlapping calls).

But I can't look at just the previous record, the data could look like this:
   s0<-------------------------->e0
          s1<-->e1
                              s2<--------->e2    
(event 2 overlaps event 0 but not event 1, all 3 should be marked as overlapping events)

Any help is greatly appreciated.

Chas Randal

Eqlipse Data

Austin, TX

1 Reply
marcus_sommer

I think to make the main-part within the script would be helpful and not against your dynamic selectings by matching your start- and end-times with a master-calendar / timetable per IntervalMatch.

- Marcus