Script error: TypeError: Cannot read property "get" from undefined multistate
Thank you for adding the get() function back into the statistics object. I can get it to work for binary data types, but I can't get it to work for multistate data.
var bulk = 1; var stagePastDay = stage.past(DAY); var bulkHours = stagePastDay.data.get(bulk).runtime / (1000*60*60); return bulkHours;
Script error: TypeError: Cannot read property "get" from undefined in <eval> at line number 3 in <eval> at line number 3
If I replace "stage" with a boolean datapoint, it works fine.
I also tried using .getStartsAndRuntime(), but that also did not work. Even the .getStartsAndRuntime() example from the "Mango Java Script" help page did not work.
How can I obtain the runtime of a given state in a multistate datapoint?
Have all the examples in the "Mango Java Script" been verified to still work after the changes?
CraigWeb last edited by CraigWeb
var bulk = 1;
var stagePastDay = stage.past(DAY);
var bulkHours = stagePastDay.data.get(bulk).runtime / (10006060);
The example on the help documents for the .get() is
return b.past(MONTH, 2).get(false).proportion;
try remove the .data on your .get call.
phildunlap last edited by
You're welcome and sorry for the confusion around this. Did you notice somewhere the documentation is incorrect? I will go comment in the referenced thread to make sure it has the correct syntax.
Thank you both. This time the error was mine. I thought the point was multistate, but I now realize it was numeric rendered as a range. So I exported its historic values, changed the point type, then imported the values back in. It works now.