# Select and create a group name using msg.payload

**URL:** <https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [12 July 2023 14:44 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771 "2023-07-12T14:44:24Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sophia.maurer](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@sophia.maurer](https://discourse.nodered.org/u/sophia.maurer)\
**Post date:** [12 July 2023 14:44 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/1 "2023-07-12T14:44:24Z")

</div>

Hello,  
I would like to create a group in Node-RED depending on the value msg.payload (It should be created and also named according to the included value), how can I do that? Is it possible with the ui-template node?

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [12 July 2023 15:44 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/2 "2023-07-12T15:44:37Z")

</div>

No you can't create groups dynamically anyhow. The ui\_template itself must be in the group to be rendered and ready to receive messages and do stuff.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [12 July 2023 22:45 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/3 "2023-07-12T22:45:00Z")

</div>

I have removed irrelevant tags to avoid confusion.

---

<div class="post-metadata">

**Author:** ![sophia.maurer](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@sophia.maurer](https://discourse.nodered.org/u/sophia.maurer)\
**Post date:** [13 July 2023 06:11 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/4 "2023-07-13T06:11:50Z")

</div>

Okay can I select an already existing group from a text dashboard node depending on a msg.payload value?

---

<div class="post-metadata">

**Author:** ![sophia.maurer](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@sophia.maurer](https://discourse.nodered.org/u/sophia.maurer)\
**Post date:** [13 July 2023 06:12 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/5 "2023-07-13T06:12:23Z")

</div>

Can I select an already existing group from a text dashboard node depending on a msg.payload value?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [13 July 2023 08:57 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/6 "2023-07-13T08:57:35Z")

</div>

Can you give us some more information, exactly what are you trying to get the dashboard to do?

---

<div class="post-metadata">

**Author:** ![sophia.maurer](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@sophia.maurer](https://discourse.nodered.org/u/sophia.maurer)\
**Post date:** [13 July 2023 09:26 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/7 "2023-07-13T09:26:54Z")

</div>

In a text node, you cannot specify parameters for the dashboard group. I have created different dashboard groups (Group1, Group2,...) and would like to set the dashboard group of a text node to a specific group (z.B. Group1) depending on the value in msg.payload (e.g. Group1, Group2).

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [13 July 2023 09:53 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/8 "2023-07-13T09:53:27Z")

</div>

OK. Why do you want to move a text node from one group to another?  
Maybe an image of what you are trying for would help me understand.

---

<div class="post-metadata">

**Author:** ![sophia.maurer](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@sophia.maurer](https://discourse.nodered.org/u/sophia.maurer)\
**Post date:** [13 July 2023 10:08 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/9 "2023-07-13T10:08:40Z")

</div>

I want to put the visualization (all the dashboard nodes) in a subflow, so that i can reuse and then visualize data according to what the subflow gets as the input

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [13 July 2023 11:40 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/10 "2023-07-13T11:40:04Z")

</div>

I don't use subflows so this is mostly guesswork.

You can use a ui-control node to hide or reveal groups [Disable a dropdown node on the basis of a switch node result - #11 by E1cid](https://discourse.nodered.org/t/disable-a-dropdown-node-on-the-basis-of-a-switch-node-result/60882/11)

So maybe you could have several groups, each with the same set of text fields.  
The subflow could populate the fields in your chosen group and reveal it, hiding the others.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [13 July 2023 12:08 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/11 "2023-07-13T12:08:20Z")

</div>

> [@sophia.maurer](#):
>
> I want to put the visualization (all the dashboard nodes) in a subflow

That's another thing you can't do. Well you can do, but it doesn't work.

---

<div class="post-metadata">

**Author:** ![sophia.maurer](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@sophia.maurer](https://discourse.nodered.org/u/sophia.maurer)\
**Post date:** [13 July 2023 12:30 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/12 "2023-07-13T12:30:50Z")

</div>

Okay good to know thanks, object-oriented programming does not work well in node red, does it?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 July 2023 12:55 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/13 "2023-07-13T12:55:49Z")

</div>

> [@sophia.maurer](#):
>
> object-oriented programming does not work well in node red, does it

You can certainly use Object Oriented programming in javascript in Function nodes or in custom node types.

The limitation on dashboard nodes in subflows is not a node-red issue, it is specific to the dashboard nodes, which are not part of the node-red core. There is work starting on a [successor to the dashboard](https://flowforge.github.io/flowforge-nr-dashboard/). If you have specific requirements I suggest you make those known via the link in that document.

At the moment, for more sophisticated UI requirements than the dashboard can cover, you can use uibuilder.

---

<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:** [12 August 2023 12:56 UTC](https://discourse.nodered.org/t/select-and-create-a-group-name-using-msg-payload/79771/14 "2023-08-12T12:56:12Z")

</div>

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