Bug in CSV node

Hello I don't understand somtehing on the csv node.
Here is my payload and the output of my csv node :
image
And I want to change the columns folowing the different data of payload I receive
image
But with the columns I configure I have the payload.cluster in the output of my csv node and I don't want to display it.

Are you able to share a small example flow with some example data so that we can import it and try it ?

Yes here is an example of my problem :

[{"id":"b5bf7afb.98cda8","type":"debug","z":"6bd6a2ca.53618c","name":"Debug general","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":800,"y":360,"wires":[]}]

That is just a debug node... make sure you select all the relevant nodes before exporting.

You could just delete that property by putting:

delete msg.payload.cluster;

In between lines 19 and 20

and move line 2 below your if statements so payload isn't set until after the property is deleted.

1 Like

Oh sorry here is the code :

[{"id":"984f86ea.b649c8","type":"inject","z":"6bd6a2ca.53618c","name":"","topic":"","payload":"{\"columns\":\"date,heure,humidity\",\"payload\":{\"date\":\"20/07/2022\",\"heure\":\"16:15:03\",\"cluster\":\"RelativeHumidity\",\"humidity\":48.53}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":420,"wires":[["705d73cd.e1255c","dc41a30a.ee4dd"]]},{"id":"6fa49b1e.475114","type":"csv","z":"6bd6a2ca.53618c","name":"","sep":";","hdrin":false,"hdrout":false,"multi":"one","ret":"\\r\\n","temp":"","skip":"0","x":790,"y":420,"wires":[["17d770f0.781e5f"]]},{"id":"17d770f0.781e5f","type":"debug","z":"6bd6a2ca.53618c","name":"pay","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":970,"y":420,"wires":[]},{"id":"b5bf7afb.98cda8","type":"debug","z":"6bd6a2ca.53618c","name":"Debug general","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":800,"y":360,"wires":[]},{"id":"705d73cd.e1255c","type":"function","z":"6bd6a2ca.53618c","name":"","func":"var colonne;\nvar payload = msg.payload.payload;\n\nif (msg.payload.payload.cluster == \"Clustertemperature\")\n{\n    colonne = \"date,heure,temperature\";\n    var columns = colonne;\n    return {columns:columns,payload:payload}\n}\nelse if(msg.payload.payload.cluster == \"NodePowerDescriptor\")\n{\n    colonne = \"date,heure,tension\";\n    var columns = colonne;\n    return {columns:columns,payload:payload}\n}\nelse if(msg.payload.payload.cluster == \"RelativeHumidity\")\n{\n    colonne = \"date,heure,humidity\";\n    var columns = colonne;\n    return {columns:columns,payload:payload}\n}\nelse if(msg.payload.payload.cluster == \"AnalogInput\")\n{\n    colonne = \"date,heure,courant\";\n    var columns = colonne;\n    return {columns:columns,payload:payload}\n}","outputs":1,"noerr":0,"x":610,"y":420,"wires":[["b5bf7afb.98cda8","6fa49b1e.475114","8fe0f494.755d98"]]},{"id":"8fe0f494.755d98","type":"debug","z":"6bd6a2ca.53618c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"columns","x":790,"y":480,"wires":[]},{"id":"dc41a30a.ee4dd","type":"debug","z":"6bd6a2ca.53618c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":540,"y":380,"wires":[]}]

I'm going to to test this thanks you

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