StartRelativeToNewest

This function will attempt to start processing on the first record whose timestamp is greater than or equal to the newest record's timestamp minus the specified interval.

Syntax

StartRelativeToNewest ( interval, orderOption )

Remarks

The StartRelativeToNewest function can be used to specify the starting condition and order option for any variable referenced in the expression. This function, as well as its parameters, will only be evaluated once when the expression is first compiled and should not reference any source variables. It should appear at the beginning of the expression and either be enclosed in parentheses or followed by a semi-colon. The interval parameter specifies the interval, in nanoseconds, to subtract from the newest record's timestamp to determine where to begin processing. The predefined time constants can be used to easily input the number of nanoseconds in a microsecond (nsecPerUSec), millisecond (nsecPerMSec), second (nsecPerSec), minute (nsecPerMin), hour (nsecPerHour), day (nsecPerDay), or week (nsecPerWeek). The orderOption parameter specifies the order in which records will be read from the table and should be one of the following constants:

OrderCollected - Records will be processed in the order in which they were collected by the datalogger. This will generally correspond with the order in which records were logged unless the data was collected from a station using one-way data or data advise.

OrderLoggedWithHoles - Records will be processed in the order that they were logged by the datalogger based upon the datalogger assigned record number. If the LoggerNet server anticipates that it will collect a gap in the record numbers (a hole), no records will be processed until the hole is collected or determined by the LoggerNet server to be uncollectible.

OrderLoggedWithoutHoles - Records will be processed in the order that they were logged by the datalogger based upon the datalogger assigned record number.  If a range of records is missing and newer records have been collected, the missing records will be skipped.

OrderRealTime - Only the newest of any record in a set of records collected from the datalogger will be collected.

NOTE: For all data sources except LoggerNet server data sources, there will be little or no difference in the behavior of OrderCollected, OrderLoggedWithHoles, or OrderLoggedWithoutHoles.

For all data source types, this function will generate a request that will attempt to start at the first record whose timestamp is greater than or equal to the timestamp of the newest table record less the specified interval in nanoseconds. For data file sources, the timestamp of the first record will be equal to the current system time less the specified interval. Note that because a virtual data source and the Public table in a server data source each have only one record, a start option function will have no effect in these cases.

Example

The following example will attempt to start at a record with a timestamp twelve hours before the newest record:

StartRelativeToNewest(12 * nsecPerHour, OrderCollected); MaxRunOverTime("Server:CR1000.Second.Temp_F",Timestamp("Server:CR1000.Second.Temp_F"),12*nSecPerHour)