ui-Control JSON Format

Here is the JSON msg.payload I am using as an input to the ui-Control Node:


The target tab is "Memory". Work good.

But, I want to re-write the object to target tab zero (0), so that if the name of the tab changes, the ui_Control will continue to work.

I have tried different JSON objects, but none work.

I need help. Re-Write the above ui_Control msg.payload to use tab (0), instead of tab "Memory".


First not possible directly using msg.tab, ie 0

You would first need to load your flow json, then filter out all ui_tab types and return the name properties.
Then you can us index 0 to add the property name to the group json.

[{"id":"0965bb151a929dda","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":380,"y":560,"wires":[["8fb335c0a1db20b7"]]},{"id":"8fb335c0a1db20b7","type":"file in","z":"d1395164b4eec73e","name":"","filename":"/your/path/to/flows.json","filenameType":"str","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":590,"y":560,"wires":[["d478de8751a8671a"]]},{"id":"d478de8751a8671a","type":"json","z":"d1395164b4eec73e","name":"","property":"payload","action":"","pretty":false,"x":650,"y":620,"wires":[["9db607cc713c5d35"]]},{"id":"9db607cc713c5d35","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"(\t    $tabs := $$.payload[$.type = \"ui_tab\"].name;\t    {\t        \"group\":{\t            \"hide\":[\t                $tabs[0] & \"_Memory-Name\",\t                $tabs[0] & \"_New\",\t                $tabs[0] & \"_Memory\",\t                $tabs[0] & \"_Backup\",\t                $tabs[0] & \"_Update\"\t            ],\t            \"show\":[\t                $tabs[0] & \"_Memory-Select\"\t            ]\t        }\t    }\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":620,"wires":[["13ac52b76848d01c"]]},{"id":"13ac52b76848d01c","type":"debug","z":"d1395164b4eec73e","name":"debug 344","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":620,"wires":[]}]

Home is my tab 0

JSONata expression to create payload object

    $tabs := $$.payload[$.type = "ui_tab"].name;
                $tabs[0] & "_Memory-Name",
                $tabs[0] & "_New",
                $tabs[0] & "_Memory",
                $tabs[0] & "_Backup",
                $tabs[0] & "_Update"
                $tabs[0] & "_Memory-Select"

You could probably save the tabs array to a context var on a daily basis and then just reference that if you wanted to, or watch the flow.json file for changes, then update the tabs array if the file has changed.

E1CD. Thanks.

I did something similar, but I thought there should be an easier way.

I used the ui-Control node to get the tab 0 (msg.tab) and name (msg.name), and put tab 0's, name into flow context as "tab".

Then I used a function node to build the ui-Control JSON concating the string: tab + "_group-name"

Since you say there is no way to write the JSON directly, I will mark this question as solved.


Next time could you provide all the relevant info, so people don't waste time providing solutions that you have already tried.

If you have a solution please provide it for others to use, marking a post the solution should really contain a solution, with a clear example.

1 Like


Your point is well taken. I do appreciate the effort you put into my original question.


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