AnsweredAssumed Answered

How to set up a Numeric Range Query for time stamps in OSISoft PIWebAPI Indexed Search

Question asked by dpfahler on Dec 12, 2018
Latest reply on Jan 22, 2019 by dpfahler

The OSISoft API Documentation for specifying a date range is quite strange (Search Queries (PI Web API Indexed Search) )

Numeric Range Queries

The previous examples were Range Queries against string fields. Numeric values > can also be searched for with Range Queries.

The only fields that are indexed as numeric fields are the CreationDate and ChangeDate fields for the respective PI Point attributes. To index these fields > add them to the list of PI Point Attributes. This configuration may be viewed > or modified on the Settings page.

These date time values are indexed as numeric values via a conversion: Dates are converted to UTC milliseconds elapsed since 12:00:00 midnight, January 1, 0001.

In the following example query is a request for last changed date equal to or > greater than February 26th, 22:16:50.000 (This is Universal Time). This DateTime, following the aforementioned conversion, would be represented as numeric value: 63655280210000. Therefore the query submitted is:

https://MyServer/piwebapi/search/query?q=changedate:[63655280210000 TO *]

From this documention I have asked a question on stack overflow (https://stackoverflow.com/questions/53743217/how-to-set-up-a-numeric-range-query-for-time-stamps-in-osisoft-piwebapi-ind… ) on how to get the milliseconds elapsed since 12:00:00 midnight, January 1, 0001.

This is not possible! (see stack overflow)

How should I formulate the query?

Thank you!

Outcomes