JSON function to hide group and tab at the same time

Hello everyone,

I would like to hide some tabs and groups and show some other only with one function node. What is the right format to do so. In the description the both functions are separated. Is it possible to combine them somehow?

I was trying this:

if(msg.tab==3){
    msg.payload=
    {"tabs":
    {"hide":
    ["Home_1","Strommessung","Mobile","Home_2"],
    "show":
    ["Home_mobile","Strom_mobile"]}},
    {"group":
    {"hide":["Home_mobile_Start"],
    "show":["Home_mobile_Start_mobile"],
   "focus":true}}
}
return msg;

but it doestn work. It only shows and hide the tabs, but not the groups. What am I missing?

Good question indeed.

Your msg.payload is not even a valid object, so it seems normal that your code will not work.

Can´t you possibly issue two different payloads for each purpose ? One for managing groups and then another one to manage tabs ?

PS: Perhaps you want to test with this modified object ? I did not test as it woudl take some time to build all those groups and tabs.

{
    "tabs": {
        "hide": [
            "Home_1",
            "Strommessung",
            "Mobile",
            "Home_2"
        ],
        "show": [
            "Home_mobile",
            "Strom_mobile"
        ]
    },
    "group": {
        "hide": [
            "Home_mobile_Start"
        ],
        "show": [
            "Home_mobile_Start_mobile"
        ]
    }
}
1 Like

It seems to work! Thank you very much!

1 Like

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