# Flow.set - One set string - One set 	 "\[object Object\]"

**URL:** https://discourse.nodered.org/t/flow-set-one-set-string-one-set-object-object/54176
**Category:** General
**Created:** [23 November 2021 19:09 UTC](https://discourse.nodered.org/t/flow-set-one-set-string-one-set-object-object/54176 "2021-11-23T19:09:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)
#### Post date: [23 November 2021 19:09 UTC](https://discourse.nodered.org/t/flow-set-one-set-string-one-set-object-object/54176/1 "2021-11-23T19:09:42Z")

</div>

I have a inject node injecting a string into a function node - The function node sets a flow.set to the string -- Happy days.

All of a sudden with no changes this flow now set the flow.set to "[object Object]" -- Un happy days.

Copy the nodes and past it in the same flow - the one set the flow.set to the string the other to "[object Object]" --- And yet the one is a copy of the other. -- The only reasons I copied the node were to try and establish what went wrong.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e314ee3c3a2ef36e15ed83d2f5fd41600f31fcc4.png)

From the bottom flow  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/0/c01db8c42c900273d03c492681a1a36820b1b0db.png)

From the top flow  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/733766a61655a17d61da98fa2ac79f0d03e14999.png)

```auto
[
    {
        "id": "6ab02e2eb769cd16",
        "type": "inject",
        "z": "6151ad3d1b9f5d2b",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "2",
        "topic": "",
        "payload": "soiot",
        "payloadType": "str",
        "x": 150,
        "y": 180,
        "wires": [
            [
                "360dec737c1e3dea",
                "9e59528565c07e48"
            ]
        ]
    },
    {
        "id": "360dec737c1e3dea",
        "type": "function",
        "z": "6151ad3d1b9f5d2b",
        "name": "",
        "func": "flow.set('db', msg.payload)\n\n\nmsg1 = {topic : \"CREATE TABLE IF NOT EXISTS `nodemap` ( `application` int DEFAULT NULL, `device` int DEFAULT NULL, `dlat` decimal(10,7) DEFAULT NULL, `dlon` decimal(10,7) DEFAULT NULL, `rssi` decimal(3,0) DEFAULT NULL, `snr` decimal(4,2) DEFAULT NULL, `sf` decimal(2,0) DEFAULT NULL, `frequency` decimal(9,0) DEFAULT NULL, `bandwidth` decimal(6,0) DEFAULT NULL, `airtime` decimal(7,6) DEFAULT NULL, `ttngateway` int DEFAULT NULL, `glat` decimal(10,7) DEFAULT NULL, `glon` decimal(10,7) DEFAULT NULL, `altitude` decimal(3,0) DEFAULT NULL, `time` timestamp NULL DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\"}\n\nmsg2 = {topic :\"CREATE TABLE IF NOT EXISTS `tapplication` (`idA` int NOT NULL AUTO_INCREMENT, `application` varchar(45) NOT NULL, PRIMARY KEY (`idA`), UNIQUE KEY `idA_UNIQUE` (`idA`), UNIQUE KEY `application_UNIQUE` (`application`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\"}\n\nmsg3 = {topic :\"CREATE TABLE IF NOT EXISTS `tdevice` (`idd` int NOT NULL AUTO_INCREMENT, `device` varchar(45) NOT NULL, PRIMARY KEY (`device`), UNIQUE KEY `idd_UNIQUE` (`idd`), UNIQUE KEY `device_UNIQUE` (`device`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\"}\n\nmsg4 = {topic : \"CREATE TABLE IF NOT EXISTS `ttngateway` (`idg` int NOT NULL AUTO_INCREMENT, `ttngateway` varchar(45) NOT NULL, PRIMARY KEY (`ttngateway`), UNIQUE KEY `idg_UNIQUE` (`idg`), UNIQUE KEY `ttngateway_UNIQUE` (`ttngateway`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\"}\n\nreturn [msg1, msg2, msg3, msg4];",
        "outputs": 4,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 330,
        "y": 180,
        "wires": [
            [
                "b34c256cf4114036",
                "9e59528565c07e48"
            ],
            [
                "b34c256cf4114036",
                "9e59528565c07e48"
            ],
            [
                "b34c256cf4114036",
                "9e59528565c07e48"
            ],
            [
                "b34c256cf4114036",
                "9e59528565c07e48"
            ]
        ]
    },
    {
        "id": "9e59528565c07e48",
        "type": "debug",
        "z": "6151ad3d1b9f5d2b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 470,
        "y": 240,
        "wires": []
    },
    {
        "id": "0e90111719f94e4b",
        "type": "inject",
        "z": "6151ad3d1b9f5d2b",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "2",
        "topic": "",
        "payload": "soiot",
        "payloadType": "str",
        "x": 110,
        "y": 60,
        "wires": [
            [
                "378e037f9769a0e9",
                "207ba41389dab50f"
            ]
        ]
    },
    {
        "id": "378e037f9769a0e9",
        "type": "function",
        "z": "6151ad3d1b9f5d2b",
        "name": "",
        "func": "flow.set('db', msg.payload)\n\n\nmsg1 = {topic : \"CREATE TABLE IF NOT EXISTS `nodemap` ( `application` int DEFAULT NULL, `device` int DEFAULT NULL, `dlat` decimal(10,7) DEFAULT NULL, `dlon` decimal(10,7) DEFAULT NULL, `rssi` decimal(3,0) DEFAULT NULL, `snr` decimal(4,2) DEFAULT NULL, `sf` decimal(2,0) DEFAULT NULL, `frequency` decimal(9,0) DEFAULT NULL, `bandwidth` decimal(6,0) DEFAULT NULL, `airtime` decimal(7,6) DEFAULT NULL, `ttngateway` int DEFAULT NULL, `glat` decimal(10,7) DEFAULT NULL, `glon` decimal(10,7) DEFAULT NULL, `altitude` decimal(3,0) DEFAULT NULL, `time` timestamp NULL DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\"}\n\nmsg2 = {topic :\"CREATE TABLE IF NOT EXISTS `tapplication` (`idA` int NOT NULL AUTO_INCREMENT, `application` varchar(45) NOT NULL, PRIMARY KEY (`idA`), UNIQUE KEY `idA_UNIQUE` (`idA`), UNIQUE KEY `application_UNIQUE` (`application`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\"}\n\nmsg3 = {topic :\"CREATE TABLE IF NOT EXISTS `tdevice` (`idd` int NOT NULL AUTO_INCREMENT, `device` varchar(45) NOT NULL, PRIMARY KEY (`device`), UNIQUE KEY `idd_UNIQUE` (`idd`), UNIQUE KEY `device_UNIQUE` (`device`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\"}\n\nmsg4 = {topic : \"CREATE TABLE IF NOT EXISTS `ttngateway` (`idg` int NOT NULL AUTO_INCREMENT, `ttngateway` varchar(45) NOT NULL, PRIMARY KEY (`ttngateway`), UNIQUE KEY `idg_UNIQUE` (`idg`), UNIQUE KEY `ttngateway_UNIQUE` (`ttngateway`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\"}\n\nreturn [msg1, msg2, msg3, msg4];",
        "outputs": 4,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 60,
        "wires": [
            [
                "207ba41389dab50f"
            ],
            [
                "207ba41389dab50f"
            ],
            [
                "207ba41389dab50f"
            ],
            [
                "207ba41389dab50f"
            ]
        ]
    },
    {
        "id": "207ba41389dab50f",
        "type": "debug",
        "z": "6151ad3d1b9f5d2b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 490,
        "y": 120,
        "wires": []
    }
]

```

```auto
23 Nov 19:08:49 - [info] Node-RED version: v2.0.6
23 Nov 19:08:49 - [info] Node.js version: v12.22.7
23 Nov 19:08:49 - [info] Linux 5.11.0-1021-aws x64 LE
23 Nov 19:08:49 - [info] Loading palette nodes
23 Nov 19:08:51 - [info] Worldmap version 2.19.0
23 Nov 19:08:51 - [info] Dashboard version 3.1.2 started at /ui

```

---

<div class="post-metadata">

### Author: ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)
#### Post date: [23 November 2021 19:53 UTC](https://discourse.nodered.org/t/flow-set-one-set-string-one-set-object-object/54176/2 "2021-11-23T19:53:01Z")

</div>

I changed the flow.set("dbc.xxx) and now it works - stores the correct value

---

<div class="post-metadata">

### Author: ![tymarbut](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@tymarbut](https://discourse.nodered.org/u/tymarbut)
#### Post date: [23 November 2021 21:56 UTC](https://discourse.nodered.org/t/flow-set-one-set-string-one-set-object-object/54176/3 "2021-11-23T21:56:39Z")

</div>

Looks like you got it sorted - somewhere, an object started moving through your flow where you were expecting a string.
