Specifying cycle count with one equity operator
- Last UpdatedMar 19, 2025
- 1 minute read
If one end of the time range is excluded (by using > instead of >= or < instead of <=). then a gap of "resolution" is left at the beginning (or end) of the result set.
The resolution is calculated as (end date – start date) / (cyclecount).
The row that equates to the time which is designated using the < (or >) operator is not returned.
These queries use the remote table view.
Query 1
This query uses a cycle count of 60, resulting in a 1 second resolution for the data. The starting time is set to >=.
SELECT DateTime, Value
FROM History
WHERE TagName = 'SysTimeSec'
AND wwCycleCount = 60
AND DateTime >= '2001-01-13 12:00:00'
AND DateTime < '2001-01-13 12:01:00'
The results are:
|
DateTime |
Value |
|
2001-01-13 12:00:00.000 |
0 |
|
2001-01-13 12:00:01.000 |
1 |
|
2001-01-13 12:00:02.000 |
2 |
|
2001-01-13 12:00:03.000 |
3 |
|
2001-01-13 12:00:04.000 |
4 |
|
... |
|
|
2001-01-13 12:00:56.000 |
56 |
|
2001-01-13 12:00:57.000 |
57 |
|
2001-01-13 12:00:58.000 |
58 |
|
2001-01-13 12:00:59.000 |
59 |
(60 row(s) affected)
Query 2
This query also uses a cycle count of 60, resulting in a 1 second resolution for the data. The ending time is set to <=.
SELECT DateTime, Value
FROM History
WHERE TagName = 'SysTimeSec'
AND wwCycleCount = 60
AND DateTime > '2001-01-13 12:00:00'
AND DateTime <= '2001-01-13 12:01:00'
The results are:
|
DateTime |
Value |
|
2001-01-13 12:00:01.000 |
1 |
|
2001-01-13 12:00:02.000 |
2 |
|
2001-01-13 12:00:03.000 |
3 |
|
2001-01-13 12:00:04.000 |
4 |
|
... |
|
|
2001-01-13 12:00:56.000 |
56 |
|
2001-01-13 12:00:57.000 |
57 |
|
2001-01-13 12:00:58.000 |
58 |
|
2001-01-13 12:00:59.000 |
59 |
|
2001-01-13 12:01:00.000 |
0 |
(60 row(s) affected)