# Dashboard 2 - Gather data from multiple dropdowns on multi tenant dashboard

**URL:** <https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [21 June 2024 13:38 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838 "2024-06-21T13:38:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![metropolis](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@metropolis](https://discourse.nodered.org/u/metropolis)\
**Post date:** [21 June 2024 13:38 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/1 "2024-06-21T13:38:39Z")

</div>

I am using Dashboard 2 to create a dashboard that contains two dropdown nodes and a button. The dashboard will be accessed simultaneously by multiple users, so I am using the multi tenancy (Accept Client Data) functionality described here: [Getting Started | Node-RED Dashboard 2.0](https://dashboard.flowfuse.com/getting-started.html#multi-tenancy)

My requirements on the surface are relatively simple, but I'm having difficulties getting it to work as desired. I want to allow users to select a value from both dropdowns, and then when the button is clicked, use the selected values from both dropdowns for further operations.

I've configured the 'Accept Client Data' as required, and have my two dropdowns working independently for each dashboard instance/tab (so changes made on one instance aren't reflected on the other). The difficulty is with correctly getting hold of the selected values when the button is clicked.

I've wired the dropdowns to a join node so that whenever they change, the payloads are combined into a single message (using the dropdown topics as the key). This allows me to pass a message containing both values on to the button. However, unlike the dashboard nodes, the join node is not client constrained, which leads to undesired behaviour.

One such issue is as follows:

- Open the dashboard
- Select a value on both dropdowns - at this point, everything is okay, and the button receives a message containing both values
- Refresh the page
- Select a value on a single dropdown - at this point, the join node still holds the values that were selected by the previous client/socket prior to refreshing the page. This causes the button to receive a message with both values (the new one, and the stale one that hasn't actually been set for this client/socket).

Is there a recommended pattern/approach for dealing with this kind of requirement?

Thanks

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [21 June 2024 13:59 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/2 "2024-06-21T13:59:00Z")

</div>

> [@metropolis](#):
>
> Refresh the page

This piece here is your challenge. Client identification in core is done with `socketId`, which does not persist a refresh of the browser.

If you're running Node-RED on [FlowFuse](https://flowfuse.com/), you could use the [FlowFuse User Addon](https://flowfuse.com/blog/2024/04/displaying-logged-in-users-on-dashboard/), which provides `user` object, and persists refreshes.

If not, then it'll be difficult for you to reliably tell that it's still the same user after a refresh.

p.s. welcome to the Node-RED forums 🙂

---

<div class="post-metadata">

**Author:** ![metropolis](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@metropolis](https://discourse.nodered.org/u/metropolis)\
**Post date:** [21 June 2024 14:21 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/3 "2024-06-21T14:21:27Z")

</div>

Thanks for the quick reply. I had read about the FlowFuse addon and the richer user functionality it provides, but unfortunately using FlowFuse is not an option for us.

Having said that, I perhaps didn't make it clear in my original post, but I'm not looking to tell that it's the same user after the refresh. The behaviour I'm trying to achieve is to have a 'clean slate' after the refresh is performed, so that as far as the dashboard and all nodes are concerned, no values have currently been set (rather than the current behaviour, where because of the join node the previous value lingers into the new dashboard socket)

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [21 June 2024 14:30 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/4 "2024-06-21T14:30:05Z")

</div>

> but unfortunately using FlowFuse is not an option for us.

Mind if I ask why?

> The behaviour I'm trying to achieve is to have a 'clean slate' after the refresh is performed

Ah, I'm with you. In that case, the `ui-control` could be useful as that emits an event when a `socket` [disconnects](https://dashboard.flowfuse.com/nodes/widgets/ui-control.html#on-disconnect), you could use that to then clear the `join` of the data relevant to the `socketId`?

---

<div class="post-metadata">

**Author:** ![metropolis](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@metropolis](https://discourse.nodered.org/u/metropolis)\
**Post date:** [21 June 2024 14:41 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/5 "2024-06-21T14:41:38Z")

</div>

> [@joepavitt](#):
>
> Mind if I ask why?

Sure - we are deploying Node-RED as part of an appliance, which already has it's own infrastructure, authentication mechanism, etc - along with the fact that resources on the appliance are limited, so we don't have the capacity to host an additional software solution on it.

> [@joepavitt](#):
>
> Ah, I'm with you. In that case, the `ui-control` could be useful as that emits an event when a `socket` [disconnects](https://dashboard.flowfuse.com/nodes/widgets/ui-control.html#on-disconnect), you could use that to then clear the `join` of the data relevant to the `socketId`?

Okay, thanks - I'll give that a try and see where I get with it.

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [21 June 2024 15:04 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/6 "2024-06-21T15:04:56Z")

</div>

> [@metropolis](#):
>
> we are deploying Node-RED as part of an appliance, which already has it's own infrastructure, authentication mechanism, etc - along with the fact that resources on the appliance are limited, so we don't have the capacity to host an additional software solution on it.

Excuse the sales pitch here, but you may be interested in the [FlowFuse Device Agent](https://flowfuse.com/docs/device-agent/introduction/) in that instance. It's a _very_ lightweight agent that sits on your appliance, then FlowFuse can connect remotely and deploy/update instances of Node-RED running on that device.

If you have Node-RED/flow updates to run across your appliances, that's all managed centrally in FlowFuse too.

---

<div class="post-metadata">

**Author:** ![metropolis](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@metropolis](https://discourse.nodered.org/u/metropolis)\
**Post date:** [24 June 2024 09:16 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/7 "2024-06-24T09:16:09Z")

</div>

> [@joepavitt](#):
>
> Excuse the sales pitch here, but you may be interested in the [FlowFuse Device Agent](https://flowfuse.com/docs/device-agent/introduction/) in that instance. It's a _very_ lightweight agent that sits on your appliance, then FlowFuse can connect remotely and deploy/update instances of Node-RED running on that device.
> 
> If you have Node-RED/flow updates to run across your appliances, that's all managed centrally in FlowFuse too.

That's good to know, unfortunately we're too far down the line in our product lifecycle to introduce such a change - but I'll keep it in mind in case we are ever able to use it.

The [user-specific context store](https://github.com/FlowFuse/node-red-dashboard/issues/1009) functionality you described is going to simplify this use case drastically, as it would allow us to simply save the selected value for the socket when the dropdown is changed, and then retrieve all the selected values (if any) for that socket when the button is clicked.

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [24 June 2024 10:46 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/8 "2024-06-24T10:46:25Z")

</div>

Good to hear, it's been bumped up our priority list

---

<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:** [24 July 2024 10:46 UTC](https://discourse.nodered.org/t/dashboard-2-gather-data-from-multiple-dropdowns-on-multi-tenant-dashboard/88838/9 "2024-07-24T10:46:51Z")

</div>

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