Maximum retrieval - NULL values and incomplete cycles
- Last UpdatedMay 02, 2025
- 2 minute read
The first NULL value in a cycle is returned.
When a maximum value is returned from a cycle that contains gaps (including a gap extended from the previous cycle) or from an incomplete cycle with the query end time located inside of the calculation cycle, the point’s quality detail is modified to flag this. This is done by performing a logical OR operation of the value 4096, which indicates a partial cycle, onto the existing quality detail.
As an example of how maximum retrieval mode handles NULLs, consider the following query:
SELECT TagName, DateTime, Value, QualityDetail
FROM History
WHERE TagName = 'A001'
AND DateTime >= '2009-09-12 00:20'
AND DateTime <= '2009-09-12 00:40'
AND wwResolution = 10000
AND wwRetrievalMode = 'Maximum'
If you run this query against the following sample data:
|
Tagname |
DateTime |
Value |
QualityDetail |
|---|---|---|---|
|
A001 |
2009-09-12 00:09 |
0.2 |
192 |
|
A001 |
2009-09-12 00:15 |
1.3 |
192 |
|
A001 |
2009-09-12 00:17 |
0.8 |
192 |
|
A001 |
2009-09-12 00:22 |
0.5 |
192 |
|
A001 |
2009-09-12 00:26 |
0.9 |
192 |
|
A001 |
2009-09-12 00:28 |
0.0 |
249 |
|
A001 |
2009-09-12 00:29 |
0.0 |
249 |
|
A001 |
2009-09-12 00:33 |
1.1 |
192 |
|
A001 |
2009-09-12 00:35 |
1.6 |
192 |
|
A001 |
2009-09-12 00:38 |
0.5 |
192 |
|
A001 |
2009-09-12 00:42 |
0.8 |
192 |
The results are:
|
Tagname |
DateTime |
Value |
QualityDetail |
|---|---|---|---|
|
A001 |
2009-09-12 00:20 |
1.3 |
192 |
|
A001 |
2009-09-12 00:26 |
0.9 |
4288 |
|
A001 |
2009-09-12 00:28 |
NULL |
249 |
|
A001 |
2009-09-12 00:35 |
1.6 |
4288 |
The sample data points and the results are mapped on the following chart. Only the data falling between the time start and end marks at 00:20 and 00:40 (shown on the chart as dark vertical lines) are returned by the query. The resolution is set at 10,000 milliseconds.
Because there is no value that matches the start time, an initial value at 00:20 is returned based on the maximum value of the preceding cycle, which is the data point at 00:15. In the two subsequent cycles, the maximum values are at 00:26 and 00:35. The quality for these two values is set to 4288 (4096 + 192). The remaining data points are excluded because they are not maximums. In addition, the first NULL at 00:28 is included, but the second NULL (at 00:29) is not.