# Sqlite database has some Nulls how to create a line graph?

**URL:** <https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053>\
**Category:** General\
**Created:** [10 October 2020 14:49 UTC](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053 "2020-10-10T14:49:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![questuk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/questuk/32/4059_2.png) [@questuk](https://discourse.nodered.org/u/questuk)\
**Post date:** [10 October 2020 14:49 UTC](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053/1 "2020-10-10T14:49:36Z")

</div>

Hi,  
I want to make a graph from my data, the Temperatures etc, come in at random times and updates it's own column and Nulls are put in every other column.

The Nulls would mess up the graph, is there a way to change Nulls to previous non null reading or as the chart is shown on Dashboard ?.

An example of what I am looking to do.

```auto
IP_24_Temperature IP_24_Humidity
16.5 Null
Null Null
Null Null
16.8 58
Null Null
Null Null
Null Null
Null 60
Null Null
16.5 61

```

What I require is ...

```auto
IP_24_Temperature IP_24_Humidity
16.5 0
16.5 0
16.5 0
16.8 58
16.8 58
16.8 58
16.8 58
16.8 60
16.8 60
16.5 61

```

...... etc

 ![Data](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/f/3f839a6b63a04d80158fc36e404e445ab7816d5e.jpeg) ![Types](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/a/6a5c36aac7cbe28a33ae19633f4507b15a3c3576.jpeg)

Thanks

---

<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:** [10 October 2020 15:18 UTC](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053/2 "2020-10-10T15:18:23Z")

</div>

Why do you have your database setup that way, wouldn't it be better (and easier) to have column labeled 'device' or 'uint' and put the device name there with it's readings. So you would end up with  
`ID, Device, Unix_Time, Day, Date, Time, Humidity, Temperature`  
Then you could query by device and adding another device would be easy as using the new name. Also, why store the Day, Date and Time when you have the Unix\_time? So your table could be  
`ID, Device, Unix_Time, Humidity, Temperature`  
and you could convert the Unix\_time to what ever date format you want (note: as of NR v1.1.0 the change node supports the moment.js library. Here is a thread explaining how to use it [Formatting times & dates with moment.js examples](https://discourse.nodered.org/t/formatting-times-dates-with-moment-js-examples/29553)

---

<div class="post-metadata">

**Author:** ![questuk](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/questuk/32/4059_2.png) [@questuk](https://discourse.nodered.org/u/questuk)\
**Post date:** [10 October 2020 16:54 UTC](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053/3 "2020-10-10T16:54:45Z")

</div>

Hi,

I think I have understood what you mean ...

Here is a mock up of your idea ?

Thanks

![ScreenHunter_20155 Oct. 10 17.48](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/0759d8ccdbafc38adaab01f6c6bf504cb0e06958.jpeg)

---

<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:** [10 October 2020 19:02 UTC](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053/4 "2020-10-10T19:02:24Z")

</div>

That correct, with it that way you can access the readings by device and shouldn’t have to worry about nulls

---

<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 December 2020 19:02 UTC](https://discourse.nodered.org/t/sqlite-database-has-some-nulls-how-to-create-a-line-graph/34053/5 "2020-12-09T19:02:42Z")

</div>

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