get
  • 02 Feb 2021
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

get

  • Dark
    Light
  • PDF

Article summary

Description

Returns a specified IoT measurement value.


Input Parameters

NameTypeRequiredDescription
nameTextYesTarget measurement name
[default]AnyNoDefault value to use if value doesn't exist
[deviceId]TextNoSource 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.


What's Next