# How to read a table with sensor data

**URL:** <https://discourse.nodered.org/t/how-to-read-a-table-with-sensor-data/39427>\
**Category:** General\
**Created:** [20 January 2021 10:39 UTC](https://discourse.nodered.org/t/how-to-read-a-table-with-sensor-data/39427 "2021-01-20T10:39:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenSch](https://avatars.discourse-cdn.com/v4/letter/b/839c29/32.png) [@BenSch](https://discourse.nodered.org/u/BenSch)\
**Post date:** [20 January 2021 10:39 UTC](https://discourse.nodered.org/t/how-to-read-a-table-with-sensor-data/39427/1 "2021-01-20T10:39:51Z")

</div>

Hey there,

i want to read and display measuring data with dashboard nodes.  
How is it possible to read a table with already measured values (.csv or .txt) and use the gauge and chart function to simulate that the sensordata is appearing for example like every second.  
When I try to read a table I only get the whole information and the gauge and chart function don´t work.  
The gauge needs the infomation piece by piece. Ich want the content of each row of the table to be displayed with the gauge or chart every second.

Structure of the table:  
sensor a; sensorvalue a; sensor b; sensorvalue b  
a;23;b;45  
a;24;b;43  
...

I hope for some example flows to solve the problem.  
Thank you for help.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [20 January 2021 11:06 UTC](https://discourse.nodered.org/t/how-to-read-a-table-with-sensor-data/39427/2 "2021-01-20T11:06:52Z")

</div>

I would read the data file, send it thru a `split` node to break it apart to one msg per row. Then send it thru a `delay` node set to 'Rate Limit' to the time interval you want.

Then you can send the data to both the `dauge` and the `chart`.

Note: you may need to add a `switch` node (or `function` node) after the `split` node in case there are header lines you need to remove.

---

<div class="post-metadata">

**Author:** ![BenSch](https://avatars.discourse-cdn.com/v4/letter/b/839c29/32.png) [@BenSch](https://discourse.nodered.org/u/BenSch)\
**Post date:** [21 January 2021 07:48 UTC](https://discourse.nodered.org/t/how-to-read-a-table-with-sensor-data/39427/3 "2021-01-21T07:48:44Z")

</div>

Hey zenofmud!  
Thank you for your answer.  
The way you described works very well!

There is only one little question.  
When i´ve got more than only one sensor data in my table i have to separate these values.  
How is it possible to split the sensordata of "senor a" and "sensor b" with the split function.  
All values are separated with ";".  
The split function can´t distinguish between values of "sensor a" and "sensor b".  
I hope I can solve the problem.

Thank you!

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [21 January 2021 11:04 UTC](https://discourse.nodered.org/t/how-to-read-a-table-with-sensor-data/39427/4 "2021-01-21T11:04:17Z")

</div>

> [@BenSch](#):
>
> How is it possible to split the sensordata of "senor a" and "sensor b" with the split function.  
> All values are separated with ";".

Do you control the creation of the data? If so, that would be the easiest way to fix it by changing the source

Will it always be in the form of `a;value;b;value`? If so, after the split, I'd feed it into a change node with this:

 ![Screen Shot 2021-01-21 at 6.01.14 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/9/1953316dae089767f794deb6e699127c134eba33.png)

```auto
[{"id":"79b7f9a0.422198","type":"change","z":"c10ca2df.4c15c","name":"{\"a\":4,\"b\":7}","rules":[{"t":"change","p":"payload","pt":"msg","from":";","fromt":"str","to":":","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"a:","fromt":"str","to":"{\"a\":","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":":b:","fromt":"str","to":",\"b\":","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload&\"}\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":120,"wires":[["931162bb.4b297","86f228c2.24a2b8"]]}]

```

and run the output thru a `json` node and now you will have a javascript object you can access as `msg.payload.a` and `msg.payload.b`

---

<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:** [4 February 2021 11:04 UTC](https://discourse.nodered.org/t/how-to-read-a-table-with-sensor-data/39427/5 "2021-02-04T11:04:19Z")

</div>

Closed on 4 February 2021 11:04 UTC

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