Count_Sampled()

Format

Count_Sampled(Expr ,StartTime [,EndTime])

Note: This function was named NumSamples in v2.6.

Returns

Returns the number of samples in an expression over a range of time.

It is possible to retrieve very large volumes of data through indiscriminate use of this function. Retrieving large amounts of Historian data across a slow network can affect system performance for all users of the system.

Inputs

Expr: The expression whose values should be counted.
Behaviour: Required
Dimension: Collection
Valid data types: Boolean, DateTime, Decimal, Integer, String, Duration, Error, Null

StartTime: The start time over which to produce the count. 
Behaviour: Required
Dimension: Collection, SingleValue
Valid data types: DateTime, Decimal, Integer, String

Note: You can use the Time() function to use a valid DateTime argument.

EndTime: The end time over which to produce the count. If not specified, it assumes the current time. 
Behaviour: Optional 
Dimension: Collection, SingleValue
Valid data types: DateTime, Decimal, Integer, String

Note: You can use the Time() function to use a valid DateTime argument.

How to format data types

Examples

Expression: Count_Sampled(Expr, Time() - 60, Time())
Result: Number of samples over the last minute (60 seconds).

Expression: Count_Sampled(Expr, Time() - 60)
Result: Number of samples over the last minute (60 seconds).

Expression: Count_Sampled(Expr, Midnight(Time()))
Result: Number of samples since midnight (the start of the day).

Expression: Count_Sampled({tag, sampleMethod = "Raw"}, Time() – 60)
Result: Number of raw values over the last minute.

Expression: Count_Sampled(Sampling(Expr, "raw"), Time() - 60)
Result: Number of raw values over the last minute.

 

Comments are closed