Just updated to V3.1 and now, for the first time, wanna try to use global enviroment variables. But I am already stucked with this first example. Output is nil
or undefined
An enviroment variable NAME
has been defined via the new editor.
[
{
"id": "3412699fcff8c757",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": "",
"env": []
},
{
"id": "5fbc9d8c656aa129",
"type": "inject",
"z": "3412699fcff8c757",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "${NAME}",
"payloadType": "env",
"x": 350,
"y": 360,
"wires": [
[
"429749928b1530b7",
"c1be07a0c1ea5915"
]
]
},
{
"id": "429749928b1530b7",
"type": "debug",
"z": "3412699fcff8c757",
"name": "setting_out",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 740,
"y": 360,
"wires": []
},
{
"id": "c1be07a0c1ea5915",
"type": "function",
"z": "3412699fcff8c757",
"name": "function 1",
"func": "var nmsg = { \"payload\" : env.get('NAME')};\nreturn nmsg",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 530,
"y": 280,
"wires": [
[
"b7ad803777339e0a"
]
]
},
{
"id": "b7ad803777339e0a",
"type": "debug",
"z": "3412699fcff8c757",
"name": "func_out",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 280,
"wires": []
}
]