# Multiple readings

**URL:** https://discourse.nodered.org/t/multiple-readings/22703
**Category:** General
**Created:** [6 March 2020 11:48 UTC](https://discourse.nodered.org/t/multiple-readings/22703 "2020-03-06T11:48:55Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Beefy\_carrot](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Beefy\_carrot](https://discourse.nodered.org/u/Beefy_carrot)
#### Post date: [6 March 2020 11:48 UTC](https://discourse.nodered.org/t/multiple-readings/22703/1 "2020-03-06T11:48:55Z")

</div>

Hi! i am trying to take in readings from a sensor and then send that data over to cloud. this process is fine. But to limit the transactions i want to send 10 readings at a time. I dont completely understand how to do that in the flow based environment, is it global variables i need to use ?

---

<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: [6 March 2020 12:01 UTC](https://discourse.nodered.org/t/multiple-readings/22703/2 "2020-03-06T12:01:49Z")

</div>

Probably not, but it is impossible to say without knowing more information. How are you collecting the data and how do you collect the ten readings together and send them?

---

<div class="post-metadata">

### Author: ![Beefy\_carrot](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Beefy\_carrot](https://discourse.nodered.org/u/Beefy_carrot)
#### Post date: [6 March 2020 12:09 UTC](https://discourse.nodered.org/t/multiple-readings/22703/3 "2020-03-06T12:09:39Z")

</div>

We are collecting the sensor data with a variable from the rev pi/ raspberry pi which is the input node. we are trying to add the data to a file node, but we do not know how to loop it, the data just gets appended to the file and the flow goes through to the last node which is the node that sends the data over to the cloud. we dont understand how we can append 10 readings to the file as a batch and only then send that batch over to the cloud. when we try to work our logic with a function it only processes one reading.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [6 March 2020 12:30 UTC](https://discourse.nodered.org/t/multiple-readings/22703/4 "2020-03-06T12:30:45Z")

</div>

maybe the batch node ? (no need for files etc)

---

<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: [6 March 2020 13:30 UTC](https://discourse.nodered.org/t/multiple-readings/22703/5 "2020-03-06T13:30:30Z")

</div>

If I understand the problem fully I think maybe a Join node configured as below might be better, that will accept 10 incoming messages and then pass them on as an array which you can then use to build the data to send to the cloud

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

You might want to provide a timeout value too so that if the sensor readings stop for some reason then it will send as many as it currently has rather than waiting for the system to recover.

---

<div class="post-metadata">

### Author: ![Beefy\_carrot](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Beefy\_carrot](https://discourse.nodered.org/u/Beefy_carrot)
#### Post date: [10 March 2020 13:24 UTC](https://discourse.nodered.org/t/multiple-readings/22703/6 "2020-03-10T13:24:56Z")

</div>

This seems to work. great reply! thanks 🙂

---

<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: [9 May 2020 13:24 UTC](https://discourse.nodered.org/t/multiple-readings/22703/7 "2020-05-09T13:24:56Z")

</div>

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