# Switch node to show group

**URL:** <https://discourse.nodered.org/t/switch-node-to-show-group/62186>\
**Category:** General\
**Created:** [4 May 2022 15:02 UTC](https://discourse.nodered.org/t/switch-node-to-show-group/62186 "2022-05-04T15:02:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![QGIO](https://avatars.discourse-cdn.com/v4/letter/q/f17d59/32.png) [@QGIO](https://discourse.nodered.org/u/QGIO)\
**Post date:** [4 May 2022 15:02 UTC](https://discourse.nodered.org/t/switch-node-to-show-group/62186/1 "2022-05-04T15:02:04Z")

</div>

Hi all,

I'm trying to show a group in a tab, once an option in the dropdown node is selected, but I'm not able to do this task.

This is my flow:

```auto
[{"id":"9d2ecefb774604a5","type":"debug","z":"f03ae4b40058fc36","name":"Outp Cerca","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":900,"y":700,"wires":[]}]

```

The tab name is: Inserimento Date Controllo  
The group name is: Inserimento data controllo

So, if the field of the dopdown node is not empty I would like to show the group Inserimento data controllo (tre dropdown node and the group are in the same tab).

COuld you help me?

Many thanks

---

<div class="post-metadata">

**Author:** ![Barbudor](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@Barbudor](https://discourse.nodered.org/u/Barbudor)\
**Post date:** [4 May 2022 17:29 UTC](https://discourse.nodered.org/t/switch-node-to-show-group/62186/2 "2022-05-04T17:29:13Z")

</div>

Your flow above only include a debug node  
You are probably missed the copy/paste

---

<div class="post-metadata">

**Author:** ![QGIO](https://avatars.discourse-cdn.com/v4/letter/q/f17d59/32.png) [@QGIO](https://discourse.nodered.org/u/QGIO)\
**Post date:** [4 May 2022 19:40 UTC](https://discourse.nodered.org/t/switch-node-to-show-group/62186/3 "2022-05-04T19:40:00Z")

</div>

Oh, sorry

```auto
[{"id":"91f420e50c0ad42e","type":"ui_dropdown","z":"f03ae4b40058fc36","name":"","label":"Cerca Strumento","tooltip":"","place":"","group":"aef9f72e2ef95f2a","order":3,"width":4,"height":1,"passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"options","topicType":"msg","className":"","x":570,"y":660,"wires":[["d5c51376a53351aa","9d2ecefb774604a5"]]},{"id":"12ddffc39e65911f","type":"MSSQL","z":"f03ae4b40058fc36","mssqlCN":"6fb70e68d89e36c4","name":"","outField":"payload","returnType":"0","throwErrors":"0","query":"SELECT CODIFICA FROM [DB_Strumentazione].[dbo].[StrumentazioneAttrezzature]","modeOpt":"","modeOptType":"query","queryOpt":"","queryOptType":"editor","paramsOpt":"queryParams","paramsOptType":"msg","rows":"","rowsType":"msg","params":[{"output":true,"name":"CODIFICA","type":"VarChar","options":{"nullable":true,"primary":false,"identity":false,"readOnly":false}}],"x":660,"y":440,"wires":[["298e52eb6cd1c44f","9f0d81814cbde772"]]},{"id":"298e52eb6cd1c44f","type":"debug","z":"f03ae4b40058fc36","name":"Out DB","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":880,"y":460,"wires":[]},{"id":"7912d6cf7ee0e4b6","type":"inject","z":"f03ae4b40058fc36","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"Inserimento Date Controllo","payloadType":"date","x":510,"y":500,"wires":[["12ddffc39e65911f"]]},{"id":"b3c4ee77f3cfb55a","type":"ui_button","z":"f03ae4b40058fc36","name":"","group":"aef9f72e2ef95f2a","order":1,"width":6,"height":1,"passthru":false,"label":"Refresh Data","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":550,"y":340,"wires":[["12ddffc39e65911f"]]},{"id":"9f0d81814cbde772","type":"change","z":"f03ae4b40058fc36","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$.payload.CODIFICA","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":520,"wires":[["91f420e50c0ad42e"]]},{"id":"68ea2f985b97320f","type":"function","z":"f03ae4b40058fc36","name":"Set msg payload","func":"\n \n msg.payload = {\"group\":{ \"show\" : [\"Inserimento_Date_Controllo_Inserimento_data_controllo\"]}} // hide Group_1 on tab2\n node.send(msg)\n\n\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":580,"wires":[["5797d396cb1cd011"]]},{"id":"597168c2a2a09fcd","type":"change","z":"f03ae4b40058fc36","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":580,"wires":[["68ea2f985b97320f"]]},{"id":"d5c51376a53351aa","type":"switch","z":"f03ae4b40058fc36","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":790,"y":600,"wires":[["597168c2a2a09fcd"]]},{"id":"5797d396cb1cd011","type":"debug","z":"f03ae4b40058fc36","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1380,"y":560,"wires":[]},{"id":"9d2ecefb774604a5","type":"debug","z":"f03ae4b40058fc36","name":"Outp Cerca","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":900,"y":700,"wires":[]},{"id":"aef9f72e2ef95f2a","type":"ui_group","name":"Ricerca Strumento","tab":"21286fd2ee7bdc0c","order":3,"disp":false,"width":"20","collapse":false,"className":""},{"id":"6fb70e68d89e36c4","type":"MSSQL-CN","name":"DB_Strumentazione","server":"XXX\\SQLEXPRESS","port":"","encyption":true,"trustServerCertificate":true,"database":"DB_Strumentazione","useUTC":true,"connectTimeout":"30000","requestTimeout":"","cancelTimeout":"","pool":"","parseJSON":false,"enableArithAbort":true},{"id":"21286fd2ee7bdc0c","type":"ui_tab","name":"Inserimento Date Controllo","icon":"assignment","order":5,"disabled":false,"hidden":true}]

```

---

<div class="post-metadata">

**Author:** ![Barbudor](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@Barbudor](https://discourse.nodered.org/u/Barbudor)\
**Post date:** [4 May 2022 21:08 UTC](https://discourse.nodered.org/t/switch-node-to-show-group/62186/4 "2022-05-04T21:08:33Z")

</div>

I think it's still missing things like the "Inserimento data controllo" group  
Also I don't have your SQL data base  
But roughly the modified sample here below shows how to hide the "Inserimento data controllo" group when you click on the "Refresh" button and then show it when you select something from the droplist.  
I hope it will give you enough hints

```auto
[{"id":"9cc560d769ae0576","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"298e52eb6cd1c44f","type":"debug","z":"9cc560d769ae0576","name":"Out DB","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":200,"wires":[]},{"id":"7912d6cf7ee0e4b6","type":"inject","z":"9cc560d769ae0576","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"Inserimento Date Controllo","payloadType":"date","x":140,"y":260,"wires":[["12ddffc39e65911f"]]},{"id":"9f0d81814cbde772","type":"change","z":"9cc560d769ae0576","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$.payload.CODIFICA","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":240,"wires":[["91f420e50c0ad42e"]]},{"id":"d5c51376a53351aa","type":"switch","z":"9cc560d769ae0576","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":360,"wires":[["ed5045df2c61ea2d","597168c2a2a09fcd"]]},{"id":"5797d396cb1cd011","type":"debug","z":"9cc560d769ae0576","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":260,"wires":[]},{"id":"9d2ecefb774604a5","type":"debug","z":"9cc560d769ae0576","name":"Outp Cerca","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":520,"y":520,"wires":[]},{"id":"b3c4ee77f3cfb55a","type":"ui_button","z":"9cc560d769ae0576","name":"","group":"aef9f72e2ef95f2a","order":1,"width":6,"height":1,"passthru":false,"label":"Refresh Data","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"Some data to be displayed","topicType":"str","x":180,"y":100,"wires":[["12ddffc39e65911f","fe8eb1b49e87e926"]]},{"id":"91f420e50c0ad42e","type":"ui_dropdown","z":"9cc560d769ae0576","name":"","label":"Cerca Strumento","tooltip":"","place":"","group":"aef9f72e2ef95f2a","order":2,"width":4,"height":1,"passthru":true,"multiple":false,"options":[{"label":"aaa","value":"AAA","type":"str"},{"label":"bbb","value":"BBB","type":"str"}],"payload":"","topic":"options","topicType":"msg","className":"","x":200,"y":420,"wires":[["d5c51376a53351aa","9d2ecefb774604a5"]]},{"id":"12ddffc39e65911f","type":"MSSQL","z":"9cc560d769ae0576","mssqlCN":"6fb70e68d89e36c4","name":"","query":"SELECT CODIFICA FROM [DB_Strumentazione].[dbo].[StrumentazioneAttrezzature]","outField":"payload","x":290,"y":200,"wires":[["298e52eb6cd1c44f","9f0d81814cbde772"]]},{"id":"e2e48888980797cf","type":"ui_text","z":"9cc560d769ae0576","group":"8e201ebdc2415f17","order":1,"width":0,"height":0,"name":"Display","label":"","format":"{{msg.payload}}","layout":"row-spread","className":"","x":940,"y":340,"wires":[]},{"id":"4e7070bf968ed897","type":"ui_ui_control","z":"9cc560d769ae0576","name":"","x":940,"y":400,"wires":[[]]},{"id":"ed5045df2c61ea2d","type":"change","z":"9cc560d769ae0576","name":"Show Inserimento data controllo","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"show\":[\"Inserimento_Date_Controllo_Inserimento_data_controllo\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":400,"wires":[["4e7070bf968ed897"]]},{"id":"597168c2a2a09fcd","type":"change","z":"9cc560d769ae0576","name":"Set text content","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":340,"wires":[["e2e48888980797cf"]]},{"id":"fe8eb1b49e87e926","type":"change","z":"9cc560d769ae0576","name":"Hide Inserimento data controllo","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"hide\":[\"Inserimento_Date_Controllo_Inserimento_data_controllo\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":440,"wires":[["4e7070bf968ed897"]]},{"id":"f914546e0e070f1f","type":"ui_spacer","z":"9cc560d769ae0576","name":"spacer","group":"aef9f72e2ef95f2a","order":3,"width":10,"height":1},{"id":"aef9f72e2ef95f2a","type":"ui_group","name":"Ricerca Strumento","tab":"21286fd2ee7bdc0c","order":1,"disp":false,"width":"20","collapse":false,"className":""},{"id":"6fb70e68d89e36c4","type":"MSSQL-CN","name":"DB_Strumentazione","server":"XXX\\SQLEXPRESS","encyption":true,"database":"DB_Strumentazione"},{"id":"8e201ebdc2415f17","type":"ui_group","name":"Inserimento data controllo","tab":"21286fd2ee7bdc0c","order":2,"disp":true,"width":"20","collapse":false,"className":""},{"id":"21286fd2ee7bdc0c","type":"ui_tab","name":"Inserimento Date Controllo","icon":"assignment","order":5,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![QGIO](https://avatars.discourse-cdn.com/v4/letter/q/f17d59/32.png) [@QGIO](https://discourse.nodered.org/u/QGIO)\
**Post date:** [5 May 2022 07:04 UTC](https://discourse.nodered.org/t/switch-node-to-show-group/62186/5 "2022-05-05T07:04:51Z")

</div>

Thanks a lot, I made some changes according to my needs and it works!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 May 2022 07:05 UTC](https://discourse.nodered.org/t/switch-node-to-show-group/62186/6 "2022-05-19T07:05:08Z")

</div>

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