How not to change the msg when switching tabs?

Good afternoon,

Does anyone know how I can change tabs without changing my msg variable, I needed to access some data that I had in the msg inside a new tab. But allways reset the variable properties.

I'm changing the tab with ui control:
image

Here is my ui control config:
image
And I want to access the msg down there:

Thanks in advance!

replying just to wake my question :slight_smile:

I'm a little unclear about what you are asking. msg's in a flow go from node to node across the wires they are attached to. If you want the data in a msg to be used in another flow, you have to store it some where. That could be in a database, a flow/global variable or even in a mqtt msg.

Not understanding what your flows are doing, I'd suggest trying usig a flow variable unless you need the data on a different editor page in which case you would use a global (you can read about context variables here: Working with context : Node-RED)

Thanks for the reply. I think it's really the use of global variables that can solve my problem, is there any way to debug global variables?

If you look at the editor's side bar, there is a Context Data option with refresh buttons
Screen Shot 2022-07-13 at 5.30.11 AM

That's what I needed. Thank you very much for the answers!

I apologize but I was left with another doubt that I think fits with the topic. How do I get the value of the variables inside a template for example? Shouldn't this log work?

console.log(flow.server);

Inside what template? The template node? the ui-template node? Something else that you haven't explained?

I'm sorry, I'm talking about ui-template.

I can show all my script, if it help:

<script>
    
    var button = document.getElementsByClassName("winscp");
    
    button[0].onclick = function(){
        
        console.log(server);
        
        //var url =  'sftp://root:Estagio.2022@192.168.10.96';
        var url =  `sftp://root:Estagio.2022@${flow.server}`;
        window.open(url, '_blank');
        
    };
    
    console.log(flow.server);

</script>

Hmmm, maybe @hotNipi can help with that.

If I could understand the issue correctly... :thinking:

Your button is not implemented in the way the Node-RED server side and dashboard would like it to be.

Long story to tell ...
But thankfully there is built in help for each node. The ui_template node has very good help page.
It shows examples how to create front-end widget which can receive messages from back-end side and how to use that data. Of course, any case is a bit different but you'll get basics done quick and correct.

Then if you still have problems, let's deal with specific questions ..

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.