How to Create Temporal Filter in GeoEvent

2662
6
03-25-2015 07:02 PM
MorakotPilouk
Esri Contributor
3 6 2,662

Temporal aspect can be added to a filter by using string templates.

Steps:

- Create a Filter

- Set up condition(s) comparing the $RECEIVED_TIME with values based on temporal templates

- Time period can be created by AND condition

- Multiple time periods can be created by AND and OR operator

- Exception can be done using NOT operator

For example the expression below shows to time periods that allow the asdi-FAA data to get through:

OR (Any of these are true)

     AND (All of these are true)

           $RECEIVED_TIME >= 15h 37m

           $RECEIVED_TIME < 15h 38m

     AND (All of these are true)

          $RECEIVED_TIME >= 15h 40m

          $RECEIVED_TIME < 15h 41m

temporal filter.png

Here's a sample list of temporal template:

- 2013y -- year = 2013

- 2013y 1M -- 2013/Jan

- 2013y 2M -- 2013/Feb

- 2013y 2M 25d -- 2013/Feb/25

- 2012y,2013y -- list of years for using with the IN operator

- 2013y 2M,2013y 1M,2013y 10M,2011y 2M -- list of year and months for using with the IN operator

- 2013y 2M 25d,2013y 2M 24d,2D -- list of year/month/date and year/month/day of week for using with the IN operator

- 11h -- 11 o'clock

- 12h -- 12 o'clock

- 12h 9m -- 12:09

- 12h 10m -- 12:10

- 12h 10m 10s -- 12:10:10

- 11h,12h,10h -- list of hours for using with the IN operator

- 12h 10m, 21h 5m -- list of hour/minute for using with the IN operator

- 12h 10m 11s,12h 11m 12s -- list of hour/minute/second for using with the IN operator

- 2D,4D -- list of days of week for using with the IN operator

- 2013y 2M 25d,12h 10m 10s,2D -- list of year/month/date, hour/minute/second, day of week for using with the IN operator

Note: One can use the Field Calculator to add the current time to a new field by entering currentTime() into the expression input box.

Tags (3)
6 Comments
AaronNash1
Occasional Contributor II

nice tutorial. thanks for sharing

lindarae
New Contributor

Hi,  and what is the system parameter for current time?

RJSunderman
Esri Regular Contributor

Linda - $RECEIVED_TIME is a property of each event record.

You might look at this as a "macro" which allows you access to an event record's internal property value. The event record does not provide access to "current time", so there is no equivalent when configuring filter expressions to allow the expression to consider the current time.

There are a couple of functions supported by the Field Calculator processor you might consider using. If you enter receivedTime() or currentTime() for a Field Calculator's expression, you can retrieve either the time the event record was received, or the system's current time. Treating these as long integer values (in epoch milliseconds) you can compare one value vs. another (less-than, greater-than, ...) or subtract "current time" from a value and then test to see if the result is positive or negative (as part of a filter expression).

- RJ

lindarae
New Contributor

Hi, 

Thanks for the prompt reply!  I was trying to use currentTime() in a Filter not a Field Calculator in 10.5.1.  I am trying to figure out if currentTime() is supposed to be working for a Filter.

The following filters do not work for me:

"if startdate < currentTime()"  when startdate is a datefield (but stored as epoch time).

"if startdateLong < currentTime()"  when startdateLong is a long.

To get the above filter to work, I need 2 field calculators to turn startdate, and currentTime() in to longs then run the comparison.

RJSunderman
Esri Regular Contributor

No, the functions receivedTime() and currentTime() will not work in a Filter expression.

The Field Calculator processor doesn't provide an expression builder, but its interpreter is more powerful and able to support function calls like those documented on the Processors page in our on-line help, beneath the Field Calculator topic.

The event properties and tags (those designated with a $ in the Filter Properties expression builder's Field drop down) only work for Filters. You cannot freehand enter functions like those Field Calculator supports into a Filter expression, but you can use a Filter's expression builder to assist in building valid filtering expressions.

lindarae
New Contributor

Hi, Thanks for the update confirming that currentTime() does not work for filters.