EMBED.subscribeFieldToFormulaChange
This method creates a subscription to a data source of Formula type.
Whenever the data changes, the callback function will be called with the updated value.
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.fieldTypeIsFormula(inputValue))
{
// Fetch data
var value = EMBED.getFormulaData(inputValue);
// update plugin when first executed
cb(value);
EMBED.subscribeFieldToFormulaChange(inputValue, function(data)
{
// update plugin every time the data changes
cb(data);
});
}