# Creating and iterating through array

**URL:** https://discourse.nodered.org/t/creating-and-iterating-through-array/24777
**Category:** General
**Created:** [13 April 2020 20:11 UTC](https://discourse.nodered.org/t/creating-and-iterating-through-array/24777 "2020-04-13T20:11:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)
#### Post date: [13 April 2020 20:11 UTC](https://discourse.nodered.org/t/creating-and-iterating-through-array/24777/1 "2020-04-13T20:11:38Z")

</div>

Following up my previous question regarding watchdogs;

> [@Watchdog for 'last seen'](https://discourse.nodered.org/t/watchdog-for-last-seen/24764/2):
>
> For a simple watchdog where persistence over a restart is not required then this can be easily done using a Trigger node, set to send nothing, then delay (25 hours in this case) then send the failure message. In addition select Extend Delay if New Message arrives. The result is that once a message is received then if there is an interval of 25 hours with no message then it will trigger. You will need an Inject node feeding it (as well as your message stream) set to fire once on restart in ord…

I'm figuring out a way to save this data into an array.

Let's say I have these 3 devices;

1. device\_1
2. device\_2
3. device\_3

My flow creates timestamps for these 3 devices;

1. 1234567
2. 1234568
3. 1234569

First, I would like to make a flow.set() for this combined data.

If stored, I would like to iterate this data to see what timestamp is overdue and to know what device\_id is to blame.

I used to do some C++/C# but it's quite a while ago and a bit different in some ways 🙂

---

<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 April 2020 20:36 UTC](https://discourse.nodered.org/t/creating-and-iterating-through-array/24777/2 "2020-04-13T20:36:34Z")

</div>

Personally I think I would do each one separately. Then put one instance of the watchdog in the path of each device. Much simpler logic.

---

<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 June 2020 20:48 UTC](https://discourse.nodered.org/t/creating-and-iterating-through-array/24777/3 "2020-06-12T20:48:13Z")

</div>

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