I’m not sure why you would want to use a Servoy Global for that. Would suggest a local variable, or a JavaScript global so the syntax reads a bit better. If your unfamiliar with JavaScript Globals, its basically just like a local variable, but you define it without using “var”, then it can be access globally, from anywhere. something like
//skip the var before, so it is global
myObject = new classObjectDefinition()
myObject.load()
I’m not sure why you would want to use a Servoy Global for that.
Our solution has 18 modules (sub-solutions), and all of them need access to the object…I thought a Servoy global was the only way to accomplish this. I didn’t know a Javascript global would work…I’ll give it a try!
However, I am now confused regarding the difference between a Servoy global and Javascript global, because I thought they were the same thing. What is the difference between the two?
If your global is a media type it should work. If it doesn’t, I would be curious as why myself. If you’re using a text global, you can serialize and de-serialize to store and restore javascript but Servoy’s JSON implementation has a show-stopper bug or two with it currently (serialize plugin looks like it got a fix recently though).
We use a couple of javascript variables for setting up session objects. Not sure if there is a practical difference between them and media globals though.
the big difference between declared globals and just javascript globals is that declared globals can be used in the ui and in relations.
The other thing is that js globals are really globals throughout everything because they go into the toplevel. (so if declared in globals.js file they are also there in a form.js file)
The last thing you can go around by just saying:
globals.xxxx = yyyy
or make your own scope kind of thing
myscope = new Object()
then somewhere else
myscope.xxx = yyyy
But David is right if the global is of type MEDIA (instead of string which is the case for you i think) then you can store js objects just fine in it.