Gawan
1
Hi,
i am reading several float values from Global and add them up in parameter payload:
var v1 = global.get('V.S.Power')||0;
var v2 = global.get('V.N.Power')||0;
var v3 = global.get('V.O.Power')||0;
msg.payload = v1 + v2 + v3;
To get a nice value for my Dashboard I try to convert the value to an INT:
msg.payload = parseInt(msg.payload);
But no matter what I try, I always get a FLOAT value instead of an INT ... showing dozens of digits behind the coma
What am I doing wrong ?
BR
Gawander
Do you return the msg after setting payload?
Gawan
3
Yes, I return two msg-Objects:
return [msg,msg2];
I pass the msg to a dashboard text Node using {{msg.payload}}
edje11
4
Try .toFixed(0);
msg.payload = parseInt(msg.payload).toFixed(0);
E1cid
5
I suspect you are returning an array to the text display in the dashboard
ie. [7, 12345]
can we see a debug of the function output?
And what is in msg2?
Do you have 2 outputs on the function?
which msg (msg or msg2) is the one going to this dashboard item?
Gawan
8
msg2 is another value but is independent, ignore it
yes, I have 2 outputs, the first one (msg) goes to the dashboard, ignore msg2
Colin
9
Put a debug node on the output going to the ui node and show us what it says.
system
Closed
10
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.