Interesting because when I select Miflora temperature I see two debugs only selecting one thing
11/21/2018, 11:25:15 AMnode: fa0129cc.c14c6
SELECT * FROM Test WHERE device='miflora' AND sensor='temp' AND epoch >= 1542731115534 AND epoch <= 1542817515534 : msg.payload : undefined
undefined
11/21/2018, 11:25:15 AMnode: fa0129cc.c14c6
SELECT * FROM Test WHERE device='miflora' AND sensor='temp' AND epoch >= 1542731115534 AND epoch <= 1542817515534 : msg.payload : undefined
undefined
Are you sure the last flow you pasted in is the correct one?
With that flow what are you seeing in the debug node on the output of the function node?
Also what do you see on the output of the db node for that query.
When I choose for example Laser 4 and last month, graphic is not showing value , its empty. But there are some value in db
This is debug results.
SELECT Value FROM Test : msg : Object
object
topic: "SELECT Value FROM Test"
complete: true
_msgid: "abda0b08.c22348"
SELECT Value FROM Test : msg : Object
object
topic: "SELECT Value FROM Test"
complete: true
title: "Chasis/laser 4 | 23.10.2018 - 22.11.2018"
_msgid: "6a41d49c.d877dc"
Please try and answer all the questions, you have not shown us what is coming out of the database node.
Also I have to ask again, do you believe that the query you just posted (Select Value from Test) is going to provide the correct data for the chart you want?
SQL Data Debug
{"topic":"SELECT Value FROM Test","complete":true,"title":"No data sour | 23.10.2018 - 22.11.2018","_msgid":"119c714d.3b230f"}
Join node debug
No data sour | 23.10.2018 - 22.11.2018
{"topic":"SELECT Value FROM Test","title":"No data sour | 23.10.2018 - 22.11.2018","_msgid":"119c714d.3b230f","payload":[[{"Value":1},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":1},{"Value":0},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0}]]}
So you ARE getting data from the join node (look at the msg.payload) {"topic":"SELECT Value FROM Test","title":"No data sour | 23.10.2018 - 22.11.2018","_msgid":"119c714d.3b230f","payload":[[{"Value":1},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":1},{"Value":0},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0},{"Value":1},{"Value":0}]]}
Looks like you need to figure out how to formate it for the chart
OK, you know the query is not what you want. I presume therefore that you still don't know what query you want. So do you agree that the problem you have is that you don't know enough about sql to know what query to use?
I looked what you suggested link yesterday and before, but there are not enough information.
I found SELECT * DROM db
just this, and nothing I success.
At the first point yes, but when I choose todayor yesterday or last month or whatever I have, It shows all records.
How can I go forward now, anyway for solution ?
if you read the Info tab for the SQL node you will see:
Using any SQL Query, the result is returned in msg.payload
Typically the returned payload will be an array of the result rows, (or an error). Using any SQL Query, the result is returned in msg.payload
Which is exactly what you are receiving. An array where each occurance contains the name of the column and the value for that column and each element in the array is one of the rows returned.
So if you just want 1's and 0's you will have to process the msg.payload to access them. You might want to look at the split node
You need the where clause to specify which period you want the data for, and if you want to put it on a chart don't you need to know the time of each sample?
Hi again.
Lots of days Im trying to make visualizing my any data for example dht11 temp and humidty or other not important what is it.
I found an example in flows side " mysql db visualizing data" .
I did same flow, created db and some value but dont see values in chart. Where I made a mistake. When I inject there are no errors but values didnt create a chart data.
I share my node here.
Please help me.
[{"id":"d66f40a1.07d79","type":"function","z":"4bb3915c.94439","name":"Criteria","func":"var timeE = msg.payload;\n//Restrict the query to pull the last 24hrs\n//of data instead of the whole db\nmsg.payload = (timeE - (1000*60*60*24));\n node.status({text:msg.payload});\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":327,"wires":[["de98ee8a.e0e78"]]},{"id":"6b580a35.e0c684","type":"debug","z":"4bb3915c.94439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":782,"y":331,"wires":[]},{"id":"7f1b14c3.41efac","type":"inject","z":"4bb3915c.94439","name":"Timestamp","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":132,"y":329,"wires":[["d66f40a1.07d79"]]},{"id":"23e04a90.dfd4b6","type":"template","z":"4bb3915c.94439","name":"Format data","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO `mydbase` (`data1`,`data2`,`time`) VALUES ({{data1}},{{data2}},{{time}})","output":"str","x":276,"y":157,"wires":[["4a385a1b.5390c4","f1bc54b2.513988"]]},{"id":"de98ee8a.e0e78","type":"template","z":"4bb3915c.94439","name":"Format query 1","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"SELECT data1,data2,time FROM th WHERE time > {{payload}}","output":"str","x":443,"y":340,"wires":[["aab2d7ac.7a1a18"]]},{"id":"d8ad0916.c2bae8","type":"change","z":"4bb3915c.94439","name":"Format data","rules":[{"t":"set","p":"payload","pt":"msg","to":"(\t $series := [\t { \"field\": \"data1\", \"label\": \"data1\" },\t { \"field\": \"data2\", \"label\": \"data2\" }\t ];\t $xaxis := \"timestamp\";\t [\t {\t \"series\": $series.label,\t \"data\": $series.[\t (\t $yaxis := $.field;\t $$.payload.{\t \"x\": $lookup($, $xaxis),\t \"y\": $lookup($, $yaxis)\t }\t )\t ]\t }\t ]\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":805,"y":282,"wires":[["1cc38dda.c1f642"]]},{"id":"4a385a1b.5390c4","type":"sqlite","z":"4bb3915c.94439","mydb":"4e79b940.206568","sqlquery":"msg.topic","sql":"","name":"save","x":445.5,"y":162,"wires":[[]]},{"id":"aab2d7ac.7a1a18","type":"sqlite","z":"4bb3915c.94439","mydb":"4e79b940.206568","sqlquery":"msg.topic","sql":"","name":"sendGraph","x":630.5,"y":318,"wires":[["6b580a35.e0c684","d8ad0916.c2bae8"]]},{"id":"386bb478.061f6c","type":"inject","z":"4bb3915c.94439","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":157,"wires":[["23e04a90.dfd4b6"]]},{"id":"f1bc54b2.513988","type":"debug","z":"4bb3915c.94439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":473,"y":63,"wires":[]},{"id":"1cc38dda.c1f642","type":"ui_chart","z":"4bb3915c.94439","name":"","group":"4459cf06.2cbf8","order":0,"width":0,"height":0,"label":"Graphic","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":971,"y":322,"wires":[[],[]]},{"id":"4e79b940.206568","type":"sqlitedb","z":"","db":"/var/www/html/dbase/mydbase","mode":"RWC"},{"id":"4459cf06.2cbf8","type":"ui_group","z":"","name":"Aksaray","tab":"929b4fa0.44b05","disp":true,"width":"20","collapse":false},{"id":"929b4fa0.44b05","type":"ui_tab","z":"","name":"Deneme","icon":"dashboard"}]