Message sequences

Hi!

I followed the tutorial here Message Sequences - Node-RED Essentials - YouTube

Trying to create this flow and add "price" as a new column, but the new price column did not show up in the debug console:
image

Can someone tell me where did I done wrong?

JSON below:

[
    {
        "id": "c1f66fa3e43837d1",
        "type": "inject",
        "z": "349547f842c76b7c",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 190,
        "y": 60,
        "wires": [
            [
                "72f8358d0717cfe9"
            ]
        ]
    },
    {
        "id": "5a725a3f065abf17",
        "type": "csv",
        "z": "349547f842c76b7c",
        "name": "",
        "sep": ",",
        "hdrin": true,
        "hdrout": "none",
        "multi": "mult",
        "ret": "\\n",
        "temp": "",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 575,
        "y": 60,
        "wires": [
            [
                "d64d3c8cfeb829ce"
            ]
        ]
    },
    {
        "id": "72f8358d0717cfe9",
        "type": "template",
        "z": "349547f842c76b7c",
        "name": "CSV Data",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "Date,Quantity,Item\n2021-01-01,4,Apple\n2021-01-02,3,Banana\n2021-01-04,5,Peach",
        "output": "str",
        "x": 375,
        "y": 60,
        "wires": [
            [
                "5a725a3f065abf17"
            ]
        ]
    },
    {
        "id": "d64d3c8cfeb829ce",
        "type": "split",
        "z": "349547f842c76b7c",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 740,
        "y": 60,
        "wires": [
            [
                "b8f69dcab2771ca2",
                "687475a9ed71c06d"
            ]
        ]
    },
    {
        "id": "b8f69dcab2771ca2",
        "type": "debug",
        "z": "349547f842c76b7c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 920,
        "y": 60,
        "wires": []
    },
    {
        "id": "687475a9ed71c06d",
        "type": "function",
        "z": "349547f842c76b7c",
        "name": "Add Cost",
        "func": "var PRICES = {\n    \"Apple\":10,\n    \"Banana\":8,\n    \"Peach\":6\n}\nmsg.payload.Cost = msg.payload.Quantity * PRICES[msg.payload.Item];\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 375,
        "y": 165,
        "wires": [
            [
                "f9def84e5e0b6380"
            ]
        ]
    },
    {
        "id": "f9def84e5e0b6380",
        "type": "join",
        "z": "349547f842c76b7c",
        "name": "",
        "mode": "auto",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": "false",
        "timeout": "",
        "count": "",
        "reduceRight": false,
        "x": 575,
        "y": 165,
        "wires": [
            [
                "8a0ca3ed561c9499"
            ]
        ]
    },
    {
        "id": "8a0ca3ed561c9499",
        "type": "csv",
        "z": "349547f842c76b7c",
        "name": "",
        "sep": ",",
        "hdrin": true,
        "hdrout": "none",
        "multi": "mult",
        "ret": "\\n",
        "temp": "",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 740,
        "y": 165,
        "wires": [
            [
                "dc7be974e1ec0df0"
            ]
        ]
    },
    {
        "id": "dc7be974e1ec0df0",
        "type": "debug",
        "z": "349547f842c76b7c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 925,
        "y": 165,
        "wires": []
    }
]

Hello

Your flow cannot be imported.
Please re-edit your post and share your flow code using the Preformatted text icon

image

1 Like

In the second CSV Node define what Columns to use to make it back into a string

image

Test Flow:

[{"id":"c1f66fa3e43837d1","type":"inject","z":"54efb553244c241f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":240,"y":580,"wires":[["72f8358d0717cfe9"]]},{"id":"5a725a3f065abf17","type":"csv","z":"54efb553244c241f","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":625,"y":580,"wires":[["d64d3c8cfeb829ce"]]},{"id":"72f8358d0717cfe9","type":"template","z":"54efb553244c241f","name":"CSV Data","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Date,Quantity,Item\n2021-01-01,4,Apple\n2021-01-02,3,Banana\n2021-01-04,5,Peach","output":"str","x":425,"y":580,"wires":[["5a725a3f065abf17"]]},{"id":"d64d3c8cfeb829ce","type":"split","z":"54efb553244c241f","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":790,"y":580,"wires":[["b8f69dcab2771ca2","687475a9ed71c06d"]]},{"id":"b8f69dcab2771ca2","type":"debug","z":"54efb553244c241f","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":580,"wires":[]},{"id":"687475a9ed71c06d","type":"function","z":"54efb553244c241f","name":"Add Cost","func":"var PRICES = {\n    \"Apple\":10,\n    \"Banana\":8,\n    \"Peach\":6\n}\n\nmsg.payload.Cost = msg.payload.Quantity * PRICES[msg.payload.Item];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":425,"y":685,"wires":[["f9def84e5e0b6380"]]},{"id":"f9def84e5e0b6380","type":"join","z":"54efb553244c241f","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":625,"y":685,"wires":[["8a0ca3ed561c9499"]]},{"id":"8a0ca3ed561c9499","type":"csv","z":"54efb553244c241f","name":"","sep":",","hdrin":false,"hdrout":"none","multi":"mult","ret":"\\n","temp":"Date, Quantity, Item, Cost","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":790,"y":685,"wires":[["dc7be974e1ec0df0"]]},{"id":"dc7be974e1ec0df0","type":"debug","z":"54efb553244c241f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":975,"y":685,"wires":[]}]

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