Good morning, I am facing a problem perhaps due to lack of knowledge.
I am working on a dashboard with different template nodes.
In a template node I fill a form with data.
Then in another template I made a restriction on an input based on the data entered in the forms of the other node.
My question is how I can have a "global" variable between the template nodes. This way in one node I save the variable and in another node I bring it and use it.
I hope I have explained myself.
Greetings and thanks
The best way to pass data to your template node is as a message property.
Here is an example using msg.payload.location and msg.payload.forecasttime:
<div class="location">
<div class="placename">
{{msg.payload.location}}
</div>
<div class="forecasttime">
 @ {{msg.payload.forecasttime}}
</div>
</div>
Yes Node-red does also offer context variables and environment variables.
You should always try and use message properties instead of these, but if you must, at least don't use a global variable unless you really need it to have global scope.
When you say "Global", are you referring to sharing variables between templates within the same client?. If that is the case, you can always set your variables as properties of the window
object, or store them in hidden HTML elements and read their value them (in any template) using document.getElementById()
.