# Execute flows only if UI needs the data / highlight outdated data on UI

**URL:** https://discourse.nodered.org/t/execute-flows-only-if-ui-needs-the-data-highlight-outdated-data-on-ui/19616
**Category:** Dashboard
**Created:** [26 December 2019 23:00 UTC](https://discourse.nodered.org/t/execute-flows-only-if-ui-needs-the-data-highlight-outdated-data-on-ui/19616 "2019-12-26T23:00:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![joergensen](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@joergensen](https://discourse.nodered.org/u/joergensen)
#### Post date: [26 December 2019 23:00 UTC](https://discourse.nodered.org/t/execute-flows-only-if-ui-needs-the-data-highlight-outdated-data-on-ui/19616/1 "2019-12-26T23:00:46Z")

</div>

Hi, I'm quite new dealing with Node-Red and have a couple of requirements where I don't find anything in the Web. This question is about just executing certain nodes if the data is requested by the UI.

Situation:

- Flow is polling data from an external source (currently every 5 seconds)
- UI is showing received data on different UI tabs
- Sometimes it happens that some polled datapoints don't answer
- Parts of the data need to be available and sent to other external software
- Parts of the data is only needed for certain tabs of the UI

I want to minimize the data traffic and just poll the required data every 5 seconds.  
That means I would need a flag for each datapoint on the UI Tab which is telling me that somebody is looking at the data - only in this case I would poll this certain datapoint every 5 seconds.

In addition I would like to have something like a data watchdog for each signal. If there was no answer for a certain datapoint after polling (let's say for 2 Minutes) I want to set either the Value on the UI to 'NA' or change the font color to grey.

I would appreciate if somebody could give me a starting point for both problems.

---

<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: [27 December 2019 07:14 UTC](https://discourse.nodered.org/t/execute-flows-only-if-ui-needs-the-data-highlight-outdated-data-on-ui/19616/2 "2019-12-27T07:14:30Z")

</div>

I think maybe you are thinking about things the wrong way. In node red you don't execute nodes, you send them messages which they act the on. So I suggest you first rephrase your question from that perspective. Then possibly nodes such as node-red-contrib-simple-gate might be useful.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [27 December 2019 08:00 UTC](https://discourse.nodered.org/t/execute-flows-only-if-ui-needs-the-data-highlight-outdated-data-on-ui/19616/3 "2019-12-27T08:00:51Z")

</div>

Aside from Colin's feedback, here are a couple pointers that may help.

To create a watchdog flow, check out this recipe in the cookbook: [https://cookbook.nodered.org/basic/trigger-timeout](https://cookbook.nodered.org/basic/trigger-timeout)

The `ui_control` node can be used to track which tab of the dashboard is open.
