CSV node discards msg.parts

Hi,

The CSV node will discard the msg.parts if the CSV file is a two liner - header and one data line.
The result is that downstream Join nodes error out "Message missing msg.parts property - cannot join in 'auto' mode"

Adding an EOL character to line two resolves the problem.

Node-RED V3.1.6

[
    {
        "id": "846ea28629fda484",
        "type": "template",
        "z": "80dfb69344348f7d",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "json",
        "syntax": "plain",
        "template": "[\n    {\n        \"key\": 1\n    },\n    {\n        \"key\": 2\n    }\n]",
        "output": "json",
        "x": 1880,
        "y": 800,
        "wires": [
            [
                "f524561a51417941"
            ]
        ]
    },
    {
        "id": "c5ac1327c29b8e58",
        "type": "inject",
        "z": "80dfb69344348f7d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1720,
        "y": 800,
        "wires": [
            [
                "846ea28629fda484"
            ]
        ]
    },
    {
        "id": "f524561a51417941",
        "type": "split",
        "z": "80dfb69344348f7d",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 2030,
        "y": 800,
        "wires": [
            [
                "fc5ff3ad7b980dd0",
                "fd5db7a29d59fbd0"
            ]
        ]
    },
    {
        "id": "b6dc6f9f18e82226",
        "type": "join",
        "z": "80dfb69344348f7d",
        "name": "",
        "mode": "auto",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": "false",
        "timeout": "",
        "count": "",
        "reduceRight": false,
        "x": 2750,
        "y": 800,
        "wires": [
            [
                "469e9054d0cf8204"
            ]
        ]
    },
    {
        "id": "469e9054d0cf8204",
        "type": "debug",
        "z": "80dfb69344348f7d",
        "name": "debug 329",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 2910,
        "y": 800,
        "wires": []
    },
    {
        "id": "fc5ff3ad7b980dd0",
        "type": "template",
        "z": "80dfb69344348f7d",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "text",
        "syntax": "plain",
        "template": "\"column1\",\"column2\"\n1,1",
        "output": "str",
        "x": 2180,
        "y": 800,
        "wires": [
            [
                "4a5100525928b664"
            ]
        ]
    },
    {
        "id": "fd5db7a29d59fbd0",
        "type": "debug",
        "z": "80dfb69344348f7d",
        "name": "debug 331",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "parts",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2190,
        "y": 740,
        "wires": []
    },
    {
        "id": "d91ef13b1c1285fc",
        "type": "debug",
        "z": "80dfb69344348f7d",
        "name": "debug 332",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 2630,
        "y": 740,
        "wires": []
    },
    {
        "id": "ba4739b42efb7cb6",
        "type": "split",
        "z": "80dfb69344348f7d",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 2470,
        "y": 800,
        "wires": [
            [
                "b75c4f15f13612a1",
                "d91ef13b1c1285fc"
            ]
        ]
    },
    {
        "id": "b75c4f15f13612a1",
        "type": "join",
        "z": "80dfb69344348f7d",
        "name": "",
        "mode": "auto",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": "false",
        "timeout": "",
        "count": "",
        "reduceRight": false,
        "x": 2610,
        "y": 800,
        "wires": [
            [
                "b6dc6f9f18e82226"
            ]
        ]
    },
    {
        "id": "4a5100525928b664",
        "type": "csv",
        "z": "80dfb69344348f7d",
        "name": "",
        "sep": ",",
        "hdrin": true,
        "hdrout": "none",
        "multi": "mult",
        "ret": "\\n",
        "temp": "",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": true,
        "x": 2330,
        "y": 800,
        "wires": [
            [
                "ba4739b42efb7cb6"
            ]
        ]
    }
]

You could also move msg.parts to a temp property, then move it back after the csv node.
e.g.

[{"id":"fc5ff3ad7b980dd0","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"text","syntax":"plain","template":"\"column1\",\"column2\",\"column3\"\n1,1,1","output":"str","x":760,"y":7600,"wires":[["4a5100525928b664"]]},{"id":"6f2fd3fd9b9c66f8","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"move","p":"parts","pt":"msg","to":"temp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":7560,"wires":[["fc5ff3ad7b980dd0","fd5db7a29d59fbd0"]]},{"id":"4a5100525928b664","type":"csv","z":"d1395164b4eec73e","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":true,"x":890,"y":7600,"wires":[["3330e4e5d607a85f"]]},{"id":"f524561a51417941","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":570,"y":7600,"wires":[["6f2fd3fd9b9c66f8"]]},{"id":"fd5db7a29d59fbd0","type":"debug","z":"d1395164b4eec73e","name":"debug 331","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":7500,"wires":[]},{"id":"3330e4e5d607a85f","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"move","p":"temp","pt":"msg","to":"parts","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":7560,"wires":[["ba4739b42efb7cb6","d91ef13b1c1285fc"]]},{"id":"846ea28629fda484","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"json","syntax":"plain","template":"[\n    {\n        \"key\": 1\n    },\n    {\n        \"key\": 2\n    }\n]","output":"json","x":420,"y":7600,"wires":[["f524561a51417941"]]},{"id":"ba4739b42efb7cb6","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1010,"y":7600,"wires":[["b75c4f15f13612a1"]]},{"id":"d91ef13b1c1285fc","type":"debug","z":"d1395164b4eec73e","name":"debug 332","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1170,"y":7500,"wires":[]},{"id":"c5ac1327c29b8e58","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":740,"y":7680,"wires":[["846ea28629fda484"]]},{"id":"b75c4f15f13612a1","type":"join","z":"d1395164b4eec73e","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":1150,"y":7600,"wires":[["b6dc6f9f18e82226"]]},{"id":"b6dc6f9f18e82226","type":"join","z":"d1395164b4eec73e","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":1290,"y":7600,"wires":[["469e9054d0cf8204"]]},{"id":"469e9054d0cf8204","type":"debug","z":"d1395164b4eec73e","name":"debug 329","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1450,"y":7600,"wires":[]}]

Most csv files would have a \n newline at the end also.

Thanks E1cid. This is exactly what I did as a workaround.

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