EMBED.subscribeFieldToQueryChange (field, callback)

This method creates a subscription to a data source of Query type.

Whenever the data changes, the callback function will be called with the updated value. Unlike Global and Formula, the data object in the callback will be an array of JSON objects. For example, if retrieving historical data, you will get back an array of timestamp, name, value, quality values.

Parameters

(JSON object) field

(function) callback(data)

Return Value

None

Example

let data = EMBED.getComponent().schema.data;
let inputValue = data.inputValue

function cb(data)
{
  console.log(‘data’, data);
}

if(EMBED.fieldTypeIsQuery(inputValue))
{
  EMBED.subscribeFieldToQueryChange(inputValue, function(data)
  {
    // update plugin every time the data changes
    cb(data);
  });
}