I am trying to filter what information gets returned in a tag history lookup.
paths = [
'[MQTT Engine]Edge Nodes/.../Calibration/Ph Calibrate PB',
'[MQTT Engine]Edge Nodes/.../Calibration/Ph4 Captured Value',
'[MQTT Engine]Edge Nodes/.../Calibration/Ph7 Captured Value'
]
startTime = system.date.parse('2023-02-01 22:10:00')
data = system.tag.queryTagHistory(paths = paths, startDate = startTime, columnNames = ["t_stamp", "pushButton", "pH4", "pH7"])
The script returns the following dataset:
| t_stamp | pushButton | pH4 | pH7 |
|------------------------------|------------|---------|---------|
| Tue Feb 07 22:42:35 UTC 2023 | NULL | 8546.0 | NULL |
| Tue Feb 07 22:42:35 UTC 2023 | NULL | 8546.0 | 12093.0 |
| Tue Feb 07 22:42:35 UTC 2023 | 0 | 8546.0 | 12093.0 |
| Wed Feb 08 22:10:21 UTC 2023 | 0 | 19113.0 | 12093.0 |
| Wed Feb 08 22:10:21 UTC 2023 | 0 | 19113.0 | 19115.0 |
| Wed Feb 08 22:10:33 UTC 2023 | 0 | 19115.0 | 19115.0 |
| Wed Feb 08 22:10:39 UTC 2023 | 1 | 19115.0 | 19115.0 |
| Wed Feb 08 22:10:40 UTC 2023 | 0 | 19115.0 | 19115.0 |
| Wed Feb 08 22:12:13 UTC 2023 | 1 | 19115.0 | 19115.0 |
| Wed Feb 08 22:12:13 UTC 2023 | 1 | 4000.0 | 19115.0 |
| Wed Feb 08 22:12:13 UTC 2023 | 1 | 4000.0 | 4000.0 |
| Wed Feb 08 22:12:14 UTC 2023 | 0 | 4000.0 | 4000.0 |
| Wed Feb 08 22:14:09 UTC 2023 | 0 | 17694.0 | 4000.0 |
| Wed Feb 08 22:14:09 UTC 2023 | 0 | 17694.0 | 17694.0 |
| Wed Feb 08 22:14:38 UTC 2023 | 0 | 4000.0 | 17694.0 |
| Wed Feb 08 22:14:38 UTC 2023 | 0 | 4000.0 | 4000.0 |
| Wed Feb 08 22:15:37 UTC 2023 | 0 | 20000.0 | 4000.0 |
.
.
.
But this returns thousands of rows, most of them I don't need.
If I just had the first tag path by itself, I get this dataset:
| t_stamp | pushButton |
|------------------------------|------------|
| Tue Feb 07 22:42:35 UTC 2023 | 0 |
| Wed Feb 08 22:10:39 UTC 2023 | 1 |
| Wed Feb 08 22:10:40 UTC 2023 | 0 |
| Wed Feb 08 22:12:13 UTC 2023 | 1 |
| Wed Feb 08 22:12:14 UTC 2023 | 0 |
What I want is the records that are returned in the second table mixed with the columns in the first.
Or better yet, I really only need the ones where there is a 1 in the first column.
| t_stamp | pushButton | pH4 | pH7 |
|------------------------------|------------|---------|---------|
| Wed Feb 08 22:10:39 UTC 2023 | 1 | 19115.0 | 19115.0 |
| Wed Feb 08 22:12:13 UTC 2023 | 1 | 4000.0 | 4000.0 |