Best way to create global variables....

Ok here is the situation. I call a grid, that can call another grid, then a form. I need the form to see various fields from the original grid.

I’ve done it to the second level, but it seems there must be an easier way to pass variables. In clarion the global variable is seen by ALL programs.
In Clarion a local variable is only seen in the module it was created in. I KNOW I’m in a different enviro. but it seems if you create a GLOBAL
it would be seen by any modules.

And I need to pass more than 1 variable, say controlid, name, address, etc…

Can someone give me some tips on creating global variables?

Thanks so much!
Pappy

Why not a Session Variable?

I have been told to create all my global variables on the first application which would be your login application under the event “OnScriptInit” and under the Applications Menu–> Global Variables set the type to “OUTPUT”, from there, all other applications can access the globals set them as Output .

Thanks both of you for the suggestions. It’s hard coming from desktop development to the web. Things are a “little” different. Thanks. Pappy

If you create them when needed you need to be aware of the mess that it can cause. If you design carefully then it wouldn’t be a big problem, but in general I like to declare them in my first application like the login page. Be aware that if you set globals and do a sc_redir that you might be wondering why the old global value is present again and you have to refresh your pages. I always advise that if you do a sc_redir at some spot you will pass the global variables there too. One thing to remember is that you do not use [] in the sc_redir. So sc_redir(myapp,glob_myvalue=12); will actually pass [glob_myvalue].