Using join Node and CSV Node

Good morning every one, I want to write an .CSV file that contains the data captured from
a sensor, i was succeeded to make the csv file when i wanted to store one parameter from the
sensor but when i try to collect other types of parameters the join node doesn't produce an output on the debugger , the following is the flow

[{"id":"a891dc25.73993","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"50881b49.b37344","type":"ttn uplink","z":"a891dc25.73993","name":"","app":"f73f7950.45c808","dev_id":"fipy-2020","field":"","x":60,"y":300,"wires":[["8f0b2a03.5ece08","63f18f8a.096dc"]]},{"id":"8f0b2a03.5ece08","type":"interval-length","z":"a891dc25.73993","format":"human","bytopic":false,"minimum":"","maximum":"","window":"","timeout":false,"msgTimeout":"","minimumunit":"msecs","maximumunit":"msecs","windowunit":"msecs","msgTimeoutUnit":"msecs","reset":false,"startup":false,"msgField":"payload","timestampField":"timestamp","repeatTimeout":false,"name":"","x":180,"y":400,"wires":[["da513d96.e4097"],[]]},{"id":"ef47ed18.99dfb","type":"join","z":"a891dc25.73993","name":"Join Data ","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":460,"y":300,"wires":[["d04adb46.0f3c28","a4b65ff0.50628"]]},{"id":"a3d96c31.7a581","type":"debug","z":"a891dc25.73993","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":180,"wires":[]},{"id":"63f18f8a.096dc","type":"function","z":"a891dc25.73993","name":"","func":"// Just a helper variable to use below\n // DataRate: msg.metadata.data_rate,\n //  msg.payload = {humidity: msg.humidity, temp: msg.temp}\n\n \n msg.topic = \"Data\"\n\n var gateways = msg.metadata.gateways;\n \n msg.payload = {DataRate: msg.metadata.data_rate,\n                rssi: gateways.map(gw => gw.rssi),\n                snr: gateways.map(gw => gw.snr),\n                Gw: gateways.map(gw => gw.gtw_id),\n            \n }\n \nreturn msg\n\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":240,"y":220,"wires":[["a3d96c31.7a581"],["ef47ed18.99dfb"]]},{"id":"da513d96.e4097","type":"change","z":"a891dc25.73993","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"Delay","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":340,"wires":[["ef47ed18.99dfb","f8196a21.da1b58"]]},{"id":"6495ce5.b08313","type":"csv","z":"a891dc25.73993","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":",","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":770,"y":300,"wires":[[]]},{"id":"d04adb46.0f3c28","type":"file","z":"a891dc25.73993","name":"File Write","filename":"D:\\To_D_Drive\\Konwledge\\Polito_Courses\\Thesis\\WSN\\Lora\\Thesis_Measures\\NodeRed\\CSV\\Couple.csv","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":620,"y":300,"wires":[["6495ce5.b08313"]]},{"id":"a4b65ff0.50628","type":"debug","z":"a891dc25.73993","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":400,"wires":[]},{"id":"f8196a21.da1b58","type":"debug","z":"a891dc25.73993","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":460,"y":500,"wires":[]},{"id":"f73f7950.45c808","type":"ttn app","z":"","appId":"fipy-2020","accessKey":"ttn-account-v2.WqRTYOa1Sfa34PTqj4PnRW5LlTjg8KOIJzAR3a3jr3I","discovery":"discovery.thethingsnetwork.org:1900"}]

The Data that comes out on the debuger is the output of the "Function" and "Interval length" Nodes

Kindly inform me what to do , i don't have any experience in javaScript

Your function node has two outputs but you are sending data to output 1 and nothing to output 2. Set the number of outputs to 1 and join both wires to that output.

1 Like

Thanks Colin, it works well now.....

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