# SubFlows and DB2 - environment variable

**URL:** https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358
**Category:** Dashboard
**Tags:** dashboard-2
**Created:** [31 March 2025 21:46 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358 "2025-03-31T21:46:23Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![JeromeVISUALS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jeromevisuals/32/40103_2.png) [@JeromeVISUALS](https://discourse.nodered.org/u/JeromeVISUALS)
#### Post date: [31 March 2025 21:46 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/1 "2025-03-31T21:46:24Z")

</div>

Hi,

I'm only starting to play with SubFlows with Dashboard2 , that looks really powerful !

I had no problem to set the subflow variables to choose the group, and use a label from that variable, but I'd like also to use that variable to specify msg.topic coming from the nodes... Maybe there is a specific typo to use it correctly, but for now here is what I get :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/55e6cc15b72c7ea413e7eb456eaee7c809be3e31.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4fbc691fb5c32b40e18515c066453c1abc389f58.png)

and the sub-flow config :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe303c269a5362ed2939a7a20d4b026af73abd6b.png)

Or maybe I just need to use a change node in the subflow for the env Variable ? then I'd use topic for the node information, and another msg property for the env ?

Any idea ?

Thanks in advance

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [31 March 2025 21:53 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/2 "2025-03-31T21:53:07Z")

</div>

You cannot do compound env vars like `top1 ${label}` in a text field (you can in an env `$` field)

> **[Using environment variables : Node-RED](https://nodered.org/docs/user-guide/environment-variables#setting-a-node-property)**

---

<div class="post-metadata">

### Author: ![JeromeVISUALS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jeromevisuals/32/40103_2.png) [@JeromeVISUALS](https://discourse.nodered.org/u/JeromeVISUALS)
#### Post date: [31 March 2025 22:16 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/3 "2025-03-31T22:16:00Z")

</div>

Ok thanks. so I need to find any way to append the env vars to msg from the subflow.

---

<div class="post-metadata">

### Author: ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)
#### Post date: [1 April 2025 07:10 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/4 "2025-04-01T07:10:40Z")

</div>

Since it's a typed input field for the topic, you could also try a JSONata expression to compose the string and the env var. 🤔

---

<div class="post-metadata">

### Author: ![JeromeVISUALS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jeromevisuals/32/40103_2.png) [@JeromeVISUALS](https://discourse.nodered.org/u/JeromeVISUALS)
#### Post date: [1 April 2025 19:20 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/5 "2025-04-01T19:20:42Z")

</div>

Yes thank you. I m not that much in JSONata, but I found a working solution.

Another question related to subflows and DB2 nodes: I got the set up working nicely, with a few instances of a subflow which includes several DB2 nodes.

Question is, how is the layout of all these nodes in subflows managed ? As far as I can see there is no tool to control the layout, and at some point when I changed the group size, I got quite a mess with the DB2 nodes layout....

Any experience to share ?

Thanks

---

<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: [1 April 2025 20:56 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/6 "2025-04-01T20:56:56Z")

</div>

> [@JeromeVISUALS](#):
>
> Another question related to subflows and DB2 nodes: I got the set up working nicely, with a few instances of a subflow which includes several DB2 nodes.
> 
> Question is, how is the layout of all these nodes in subflows managed ?

Multiple ui nodes in a subflow is not yet fully supported, there is no convenient way of specifying the order. See [Widget ordering in subflows · Issue #1062 · FlowFuse/node-red-dashboard · GitHub](https://github.com/FlowFuse/node-red-dashboard/issues/1062)

---

<div class="post-metadata">

### Author: ![JeromeVISUALS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jeromevisuals/32/40103_2.png) [@JeromeVISUALS](https://discourse.nodered.org/u/JeromeVISUALS)
#### Post date: [2 April 2025 22:36 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/7 "2025-04-02T22:36:32Z")

</div>

Great, I really hope it will be adressed soon. I had a look into the relevant issues on GitHub and could see I'm not the only one waiting for it.

The concept is really powerful, will be really great once that stuff is solved.

Anyway for now, as soon as I have all sub-flows instances in a group without anything else, I can deal with 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: [3 April 2025 07:39 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/8 "2025-04-03T07:39:25Z")

</div>

Please add a comment to the issue so that is clear that others would like to see this sorted.

---

<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: [17 April 2025 07:40 UTC](https://discourse.nodered.org/t/subflows-and-db2-environment-variable/96358/9 "2025-04-17T07:40:13Z")

</div>

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