Is it possible to do a global.get that is set to a variable? I want to build my variable and get the global data of that variable.
msg.payload = msg.payload + "Servers";
var servers=global.get('msg.payload');
Is it possible to do a global.get that is set to a variable? I want to build my variable and get the global data of that variable.
msg.payload = msg.payload + "Servers";
var servers=global.get('msg.payload');
[{"id":"6ec4d82f.64734","type":"inject","z":"841ea37b.92289","name":"","topic":"","payload":"boop","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":910,"wires":[["68263156.b20ad8"]]},{"id":"68263156.b20ad8","type":"change","z":"841ea37b.92289","name":"","rules":[{"t":"set","p":"test","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":910,"wires":[[]]},{"id":"4a3e4396.485344","type":"function","z":"841ea37b.92289","name":"","func":"var testval = global.get(\"test\")||0;\nmsg.payload = testval;\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":980,"wires":[["c9e8ce97.7daa38"]]},{"id":"5420088a.251d68","type":"inject","z":"841ea37b.92289","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":980,"wires":[["4a3e4396.485344"]]},{"id":"c9e8ce97.7daa38","type":"debug","z":"841ea37b.92289","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":430,"y":980,"wires":[]},{"id":"a922b1f6.e671d8","type":"inject","z":"841ea37b.92289","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":860,"wires":[["68263156.b20ad8"]]}]
Yep, and almost exactly as you describe. Play with this if that's how you learn.
Thank you Jay. I got it to work. Sweet!