Accueil → WINDEV 23 → Assigning values to project level variables
Assigning values to project level variables
Débuté par Don Schwirtlich, 30 aoû. 2018 00:12 - 3 réponses
Posté le 30 août 2018 - 00:12
I set up a project level variable - gsEmailString. I also assigned it a value at the project level - then later in a login page, i have the user enter an email address Edt_Email - and then
in code, i have tried both server and browser code, set the project level variable equal to the value in Edt_Email as in gsEmailString = Edt_Email, then i do an Info() - and gsEmailString has the now current email address. - and then I go to another page - and display the value of the gsEmailString - and it is reset to the original value.

I assume this is a scope issue - but what do you use to pass a value from one page to another. I know we can use parameters to pass values - I want to make use of what is being called project level variables , not just for passing an email id along, but results of calculations, etc. Help ?

Posté le 30 août 2018 - 04:40
DeclareAWPContext - rock and roll. Had hoped this was covered in some as yet unseen pcsoft magic.
Posté le 30 août 2018 - 14:34
Hi Don,

I'm happy you found a solution... But your solution shows another problem: you currently do not know how to ask questions :-)

More precisely, pb in webdev have a very narrow context... awp, classic mode, php mode, browser or server code, ajax... LOTS of things will change the way things work and the answers we can give you... If you do not give us your context, we cannot answer you...

And another thing that will explain your original problem: an awp page is a stand alone program. Therefore each time an awp page is started, the project code will be run (and your global variable will be set with it's original value)

So yes, declareawpcontext is one solution; but be aware that it relies on cookies to work, and that any user forbidding cookies will get a non functional web site.

I prefer to store all my global variables values inside a session record in my DB and pass MY session ID from one page to the next... No cookies needed.

Best regards
Posté le 30 août 2018 - 15:02
Your approach is the one I am mostly likely going to use (storing 'global' data in the db - and passing sessionid via parameters, etc) - and the information you just gave me is very helpful. And according to what I read,


does not rely on cookies to work.

And thanks for you for very helpful criticism on my asking questions, i am amazed that all of you arent able to read my feeble mind and know what I really need, lol. I will do better, thanks as always Fabrice, you are a good friend.

Best regards,