# Context in subflow

**URL:** <https://discourse.nodered.org/t/context-in-subflow/76364>\
**Category:** Developing Nodes\
**Created:** [9 March 2023 22:29 UTC](https://discourse.nodered.org/t/context-in-subflow/76364 "2023-03-09T22:29:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterpreininger](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/peterpreininger/32/56971_2.png) [@peterpreininger](https://discourse.nodered.org/u/peterpreininger)\
**Post date:** [9 March 2023 22:29 UTC](https://discourse.nodered.org/t/context-in-subflow/76364/1 "2023-03-09T22:29:37Z")

</div>

I created a node, that creates energy data (actual energy consumption of the day until now and actual energy data of the hour). Additionally it generates historic consumption data of hour/day/...  
for calculating that, I use the context in the subflow. The big problem ist that when I change something within the subflow and submit again, my flow variable is deleted. Is there any way to mitigate this or do I have to store the date in another context (globally).

Thank you for your assistance

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [9 March 2023 22:33 UTC](https://discourse.nodered.org/t/context-in-subflow/76364/2 "2023-03-09T22:33:10Z")

</div>

> [@peterpreininger](#):
>
> The big problem ist that when I change something within the subflow and submit again, my flow variable is deleted.

You may need to expand on what you mean there.

If you change ANYTHING in the subflow and DEPLOY it, ALL DATA is lost.  
(As in edit any of the nodes, wires, etc)

---

<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:** [8 May 2023 22:34 UTC](https://discourse.nodered.org/t/context-in-subflow/76364/3 "2023-05-08T22:34:03Z")

</div>

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