I would recuperate the value of a variable in the template node. The value of this variable is calculated in a function node.
Asked
Active
Viewed 394 times
0
-
1I'm not sure "recuperate" is the right word. Can you describe what you're trying to do? – Rup Jul 19 '18 at 12:56
-
I have a variable in the function node. I would use the value of this variable in my template node. The variable is an array. I need this array in my template node to make a chart. – etudiante Jul 19 '18 at 15:55
-
@AKX I have a variable in the function node. I would use the value of this variable in my template node. The variable is an array. I need this array in my template node to make a chart. – etudiante Jul 19 '18 at 16:02
1 Answers
1
The way to pass your array out of the function
node, so it can be used inside the ui_template
node, is to return it as the payload -- like so:
var array = [12, 34, 56]; // or whatever
msg.payload = array;
return msg;
In your ui_template
code, you can then use the Angular ng-repeat
directive to iterate over the payload array -- for example, to put them into a simple 1-column table:
<table>
<tr ng-repeat="value in msg.payload">
<td>{{value}}</td>
</tr>
</table>
But, if your goal is to plot them on a line or bar chart, it would be far easier to use the built-in dashboard ui_chart
node.

SteveR
- 1,015
- 8
- 12
-
Whithout the table balise I would use the msg.payload directly in the template node. – etudiante Jul 20 '18 at 10:17