Delta retrieval - query 1
- Last UpdatedFeb 28, 2025
- 2 minute read
As an example of how delta mode works, 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 wwRetrievalMode = 'Delta'
This query can be run against the following sample data:
|
Tagname |
DateTime |
Value |
QualityDetail |
|---|---|---|---|
|
A001 |
2009-09-12 00:11 |
1.0 |
192 |
|
A001 |
2009-09-12 00:13 |
1.6 |
192 |
|
A001 |
2009-09-12 00:16 |
1.3 |
192 |
|
A001 |
2009-09-12 00:21 |
2.0 |
192 |
|
A001 |
2009-09-12 00:24 |
1.2 |
192 |
|
A001 |
2009-09-12 00:27 |
1.2 |
192 |
|
A001 |
2009-09-12 00:28 |
0.0 |
249 |
|
A001 |
2009-09-12 00:29 |
0.0 |
249 |
|
A001 |
2009-09-12 00:32 |
0.6 |
192 |
|
A001 |
2009-09-12 00:35 |
0.0 |
249 |
|
A001 |
2009-09-12 00:37 |
1.5 |
192 |
|
A001 |
2009-09-12 00:43 |
1.3 |
192 |
A graphical representation of the data is as follows:
The results are:
|
Tagname |
DateTime |
Value |
QualityDetail |
|---|---|---|---|
|
A001 |
2009-09-12 00:20 |
1.3 |
192 |
|
A001 |
2009-09-12 00:21 |
2.0 |
192 |
|
A001 |
2009-09-12 00:24 |
1.2 |
192 |
|
A001 |
2009-09-12 00:28 |
NULL |
249 |
|
A001 |
2009-09-12 00:32 |
0.6 |
192 |
|
A001 |
2009-09-12 00:35 |
NULL |
249 |
|
A001 |
2009-09-12 00:37 |
1.5 |
192 |
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 2009-09-12 00:20 and 2009-09-12 00:40 (shown on the chart as dark vertical lines) are returned by the query.
Because there is no value that matches the start time, an initial value at 2009-09-12 00:20 is returned in the results based on the value of the preceding data point at 2009-09-12 00:16. Because there is no change in the value at 2009-09-12 00:27 from the value at 2009-09-12 00:24, the data point appears on the chart but does not appear in the results. Similarly, the second 0.0 value at 2009-09-12 00:29 is also excluded from the results.
You can further control the number of rows returned by using the wwTimeDeadband, wwValueDeadband, and wwCycleCount extensions. The use of a cycle count returns the first number of rows within the time range of the query. For more information, see -old-Using wwResolution, wwCycleCount, and wwRetrievalMode in the Same Query.
Also, the use of a time deadband and/or value deadband with delta retrieval produces differing results. For more information, see Time deadband (wwTimeDeadband) and Value deadband (wwValueDeadband).