I have a need to access variables common to all flows, i am creating/setting the values in a dashboard flow devoted to ui and wish to access the values set (or their default) in flows that perform tests and stimulate further action conditionally.
when looking up how to do this i found https://nodered.org/docs/creating-nodes/context
but when i tried to declare variables in that format with the keyword 'this' i got errors, which led me to find posts on the google group suggesting that the node red functions page detailed everything i needed to know. so i have been back there, https://nodered.org/docs/writing-functions
The global context can be pre-populated with objects when Node-RED starts. This is defined in the main settings.js file under the functionGlobalContext property.
So I dont Have to declare and predefine them in that file, i can just add a '||DefaultVal' suffix to my global.get()??
my recollection of the google trail is sketchy but i seem to recall reading that the page referring to the 'this' object was out of date, but the page it links to discusses release 0.19.. but its an official node red doc page??
so in my ui flow i am using
var P1MML = global.get('P1MML')||30;
and in my other flows accessing the global
P1MML = global.get('P1MML')||30;
anything else needed???