- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Description
Returns a specified IoT measurement value.
Input Parameters
Name | Type | Required | Description |
---|---|---|---|
name | Text | Yes | Target measurement name |
[default] | Any | No | Default value to use if value doesn't exist |
[deviceId] | Text | No | Source IoT device identifier |
Returns
Type: Any
Returns the specified measurement value or null if it does not exist or is empty.
If a default value is specified and the measurement doesn't exist, then the default value is returned as the value. This offers a simple way to avoid checking if a measurement exists before retrieving it.
Note
The underlying data type of the returned value is determined when a measurement is captured from a source IoT device.
Examples
// get bpm measurement value
// returns null if doesn't exist
var bpm = iot.get("bpm");
// get bpm measurement value
// returns a default value of 80 if doesn't exist
var bpm = iot.get("bpm", 80);
Remarks
For object types that support it, multiple values are separated using the pipe '|' character between each value.