JS Example Logical Error


#1

When editing code for a Dashboard, there is some example JS code:

// Example: Convert temp from C to F and truncate to 2 decimal places.
// return (datasources[“MyDatasource”].sensor.tempInF * 1.8 + 32).toFixed(2);

Shouldn’t that be “.sensor.tempInC” if you’re converting from C to F? :stuck_out_tongue:


#2

That does look like a typo! Could you share the link to the page where you found this? I’ll get it fixed.

-Martin


#3

Also should be resources[“MyDataSource”], not datasources.

Not in any page I can decipher. In a new Dashboard, I add a widget, tell it to be an “Indicator Light”, then on the “value” entry click on the “.JS EDITOR”, and it is there as an example.


#4

We did change this in an update to Murano. I’ll make sure we get this updated along with the example text in the .JS Editor.