I’m just sharing how I’ve ended up managing variables that must be local to an application, but accessible from every local code (in events, buttons, etc.)
I’m using Programming > Attributes.
But to avoid to manually creating them (the SC IDE interface slows down this process), especially if have more than one or two, I just create a single attribute with the name “a”.
Then the first time I need to populate a specific attribute, I write something like this in the code:
{a}[‘myname’] = “myvalue”;
I can create and then access directly in the php code as many {a}[‘xxx’], {a}[‘yyy’], etc as I need, with just one “a” attribute created via Programming > Attributes.
AFAIK the only limitations are:
- in a grid app SQL, the “{a}[‘myname’]” syntax cannot be used, so in that case a specific attribute must be created, e.g. {myname} - note that in form app sql attributes cannot be used at all
- in some types of applications, before being able to create any “{a}[‘xxx’]”, the {a} attribute must be initialized as an array via “{a} = array();”.