Quality rule - query 3
- Last UpdatedFeb 07, 2025
- 1 minute read
When you combine the same OPC quality then that OPC quality will be returned. However, when there is no good point in a cycle for cyclic modes such as Integral, Average, Counter, or AnalogSummary, the returned NULL value will have an OPC quality of 0 and a Quality Detail of 65536, regardless of combined qualities.
SELECT TagName, StartDateTime, EndDateTime, OPCQuality, PercentGood, wwRetrievalMode, first
FROM AnalogSummaryHistory
WHERE TagName = 'F0R5'
AND StartDateTime >= '2009-09-12 00:20'
AND EndDateTime <= '2009-09-12 00:40'
AND wwResolution = 10000
AND wwRetrievalMode = 'Cyclic'
If you run this query against the following sample data:
|
Tagname |
DateTime |
Resolution |
QualityDetail |
|---|---|---|---|
|
F0R5 |
2009-09-12 00:07 |
1.6 |
78 |
|
F0R5 |
2009-09-12 00:14 |
3.1 |
78 |
|
F0R5 |
2009-09-12 00:22 |
0.2 |
78 |
|
F0R5 |
2009-09-12 00:25 |
0.8 |
78 |
|
F0R5 |
2009-09-12 00:27 |
0.4 |
78 |
|
F0R5 |
2009-09-12 00:29 |
2.2 |
78 |
|
F0R5 |
2009-09-12 00:33 |
3.3 |
78 |
|
F0R5 |
2009-09-12 00:36 |
0.3 |
78 |
|
F0R5 |
2009-09-12 00:39 |
1.2 |
78 |
The results are:
|
Tagname |
StartDate Time |
EndDate Time |
OPCQuality |
PercentGood |
wwRetrievalMode |
first |
|---|---|---|---|---|---|---|
|
F0R5 |
2009-09-12 00:20 |
2009-09-12 00:30 |
78 |
100 |
CYCLIC |
0.200 |
|
F0R5 |
2009-09-12 00:30 |
2009-09-12 00:40 |
78 |
100 |
CYCLIC |
3.300 |