TotalOverTimeWithReset

This function returns the total of all values since the function was reset.

Syntax

TotalOverTimeWithReset ( number, valueTimestamp, resetOption, doReset [optional])

Remarks

The number parameter specifies the data value for which the total is calculated. The valueTimestamp is the timestamp for this data value. (The Timestamp function can be used to obtain this timestamp.) The resetOption specifies when the total will be reset.  This parameter must contain one of the following predefined constants: RESET_HOURLY, RESET_DAILY, RESET_WEEKLY, RESET_MONTHLY, RESET_YEARLY, or RESET_CUSTOM. For example, RESET_MONTHLY will cause the total to be reset whenever there is a change in the month in the value's timestamp. RESET_CUSTOM will cause the total to be reset whenever the doReset parameter is set to a non-zero value.

Any value that evaluates to –INF, INF, or NAN will be ignored. If there are no valid values stored, this function will return NAN.

Examples

Example #1

The following example will return the total of the variable Rain. The value will be reset at the beginning of each day.

TotalOverTimeWithReset("Server:CR1000.Hourly.Rain",TimeStamp("Server:CR1000.Hourly.Rain"), Reset_Daily)

Example #2

The following example will return the total of the variable Rain.  The value will be reset on October 01.

TotalOverTimeWithReset("Server:CR1000.Minute.Rain",Timestamp("Server:CR1000.Minute.Rain"),RESET_CUSTOM,
ToInt(FormatTime(Timestamp("Server:CR1000.Minute.Rain"), $"%m%d%H%M")) = 10010000)

Example #3

The following example will return the total of the variable Rain.  The value will be reset each Tuesday at 9:00 a.m.

TotalOverTimeWithReset("Server:CR1000.Hourly.Rain",Timestamp("Server:CR1000.Hourly.Rain"),RESET_CUSTOM,
ToInt(FormatTime(Timestamp("Server:CR1000.Hourly.Rain"), $"%w%H%M")) = 20900)

Example #4

The following example will return the total of the variable Rain. The value will be reset daily at 9 a.m.

TotalOverTimeWithReset("Server:CR1000.Hourly.Rain",Timestamp("Server:CR1000.Hourly.Rain"),RESET_CUSTOM,ToInt(Timestamp("Server:CR1000.Hourly.Rain")) MOD nsecPerDay=nsecPerHour*9)

Example #5

The following example will return the total of the variable Rain. The value will be reset every other day at midnight.

TotalOverTimeWithReset("Server:CR1000.Hourly.Rain",Timestamp("Server:CR1000.Hourly.Rain"),RESET_CUSTOM,ToInt(Timestamp("Server:CR1000.Hourly.Rain")) MOD (2*nsecPerDay)=0)