Common Queries
About
This section shows a collection of queries that are typically used for displaying device data. You can use this section to get some creative ideas how to display data of your devices. Refer to Database to learn more about the PostgreSQL of NOA Portal and how to access the data using your queries.
Standard query
Use this query to display a single datapoint from the measurements table of a device.
SELECT
$__timeGroupAlias("timestamp", $__interval),
parameter_id AS metric,
last(value, "timestamp") AS "value"
FROM "PDMEdge59".measurements
WHERE
$__timeFilter("timestamp") AND
parameter_id = 'KEBPdMService.635.BatteryVoltage'
GROUP BY 1, 2
ORDER BY 1, 2
Display multiple datapoints
Use this query to display two datapoints from the measurements table of a device.
SELECT
$__timeGroupAlias("timestamp", $__interval),
CASE
WHEN parameter_id = 'dr-boy-K-demo.Root.Objects.OPCUA_Variables.ActAverageCycleTime' THEN 'Average Cycle Time'
WHEN parameter_id = 'dr-boy-K-demo.Root.Objects.OPCUA_Variables.LastCycleTime' THEN 'Last Cycle Time'
ELSE parameter_id
END AS metric,
last(value, "timestamp") AS "value"
FROM "PDMEdge59".measurements
WHERE
$__timeFilter("timestamp") AND
parameter_id IN (
'dr-boy-K-demo.Root.Objects.OPCUA_Variables.ActAverageCycleTime',
'dr-boy-K-demo.Root.Objects.OPCUA_Variables.LastCycleTime'
)
GROUP BY 1, 2
ORDER BY 1, 2

