Need help calling variables in a JSON array generated in a change node

Hey everyone, first post here so please forgive any information being left out. I'm very new to Node Red and am trying desperately to figure this out on my own, but I've reached my wit's end. I'm currently using Node Red v4.0.2, and attempting to dynamically populate a dropdown element from Dashboard 2. Additionally, I want this dropdown to contain both labels and values.

I've already got the variables that I want loaded into the dashboard set globally. However, my issue is arising in trying to call these variables in a JSON array that I'm creating in a change node. Please see the photos below for my variables, as well as how I'm trying to call them in the change node.


Am I just barking up the wrong tree with this? Is there any easier way to dynamically populate a Dashboard 2 dropdown with variables? Any and all help would be greatly appreciated.

You can use the expression type input J: of the change node to do this or a template node.

But it maybe a lot easier to do this when you create the globals. Rather than individual globals add all elements in an array.

Where is the names and sensors coming from.

Provide text examples of these inputs, rather than images, then we can offer example flows, using your data.

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path/value for any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

1 Like

Hello, thank you for the response!

The Names and Sources variables are coming from a API call that I'm using a custom node to retrieve. Copying the path from them only gets me the names of the variables. I apologize if I'm misunderstanding what you're asking for.

Additionally, I'm interested in your second sentence. How would I go about adding these variables directly into an array on creation? Being able to do that would make this entire process much smoother.

Try copy value rather than copy path.
Once I have data i can create an example.