Dashboard ui_control: show / enable Tabs using variable not hard-coded

Hi,

Windows 10. Node-RED 1.1.2. Dashboard 2.22.1

I have a flow that works very well. It uses Dashboard to display multiple Tabs each with a unique name. "ui_control" lets me hide / show & jump to tabs very easily.

Example:
{"tabs": {"show": "P360 Account Setup"}} followed by
{"tabs": {"enable": "P360 Account Setup"}} then
{"tab":"P360 Account Setup"}

Note - "P360 Account Setup" is the Tab name and there are ~ 30 different Tabs.

What I want to do (to eliminate tons of duplicate code and remove a source of error) is to make the Tab name a variable. E.g. {"tabs": {"show": msg.Tab}} where variable msg.Tab was previously set to the correct value.

Is this even possible? How might I go about this?

Cheers,

Paul

basically what you have there... did you try it ?

Hi,

I tried it using a Change Node. It puts a red border around the statement indicating it is not valid JSON:

If I include the double-quotes it is valid JSON but does not work.

Cheers,

Paul

ah sorry - thought you had that in a function node

You can use the jsonata format (note, no msg.)
image

Feed it into a debug node to check it looks right.

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