reset / clear all globals command.

A controller to clear/delete/set all globals would be nice.

Like:

all.globals = 0;

or something like this..

Rainer

i can’t think of a solution when that would be very practical..
because there is always one global that shouldn’t be 0
and what do you mean with 0 for a string global field? or media?
So i think you mean globals = null?

Sure null is much more better :)

I just thought of a function that could reset or set all globals to a new value.
E.g. if i have 35 globals i would have to use a code like:

..
myglobal_1 = null;
myglobal_2= null;
etc..

It would ne nicer if i could use a statement that affects all globals, regardless of their name or quantity.

Like

all.globals = null; ( or another value..)
all.globals = “EMPTY”

Rainer

Better would be a function to get the names of all globals. I would envision this off the app object.

application.globals

While would return pointers to all the globals. Yould could then loop through them with a for loop. This would allow you to test for values within them before wiping them out.

I would also be nice to be able to see what public variables Javascript has created.

Given that

x = “something”

is different than

var x = “something”

I am wondering. Is Servoy keeing Javascript variables persistent even when a method is completed? I know locally scoped variables are destroyed. Is x = “something” kept alive?

i can make it so that you can do this:

for(var i=0;i<globals.length;i++)
{
globals = xxxx;
}
i still don’t know exactly what you could really do with this (except setting everything to null…)
for youre other question:
if you do :
myGlobal = ‘xxxxyyyxxxx’
then you can acces that one in another method at a later time just fine.
So setting some variables in a onLoad of a form for usage after that will work fine.