Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 1 Jahr, 6 Monaten
Letzter Beitrag:
vor 1 Jahr, 5 Monaten
Beteiligte Autoren:
Peter Hite, Peter Holemans, Fabrice Harari, Allard

Webdev Globals

Startbeitrag von Peter Hite am 27.05.2016 18:44

I am new to writing Web apps and am having a hard time getting my head around global variables. I would like to be able to use a couple of global variables to hold states, etc. But every time I submit something to the server (a page refresh, new page, etc.), the project initialization code reinitialized the globals. Is there anyway to set a global and keep it throughout a session, or do I just need to pass those values as parameters to all of my different pages? Thanks

Antworten:

Hi Peter,

it depends of the type of pages you are using: classic, awp or php

Best regards

von Fabrice Harari - am 27.05.2016 19:17
Currently the project site is configured as Dynamic AWP. I have 5 globals defined in project server initialization. That initialization code seems to be recalled each time a page is refreshed,

von Peter Hite - am 27.05.2016 19:31
Hi

If you use dunamic webdev then your globals are useble the way you discribe. If you use AWP you have to pass the global to the page as a param.

In the calling of the page

pagedisplay( thepageyou call, paramglobal)

In the page that is called add a procedure

PROCEDURE mypage( var is string )

Then use var to get the value of you global

regards
Allard

von Allard - am 27.05.2016 19:55
Hi,

Thank you Allard. I think I'll pass them as suggested. Hopefully I can use a composite variable to pass them all easily. I changed the project to Dynamic Webdev, put a break in the server init code, and it still calls the reinitialization of the globals. Don't know why - will try above and scratch my head another day on this one.

von Peter Hite - am 27.05.2016 20:37
Hi Peter,

You can declare an AWP context to store your global variables in AWP mode (server side if you want).
Check ConfigureAWPContext() and DeclareAWPContext() in the help for that.

In the project init code you get the previous values again stored by these same commands.

Best regards,

Peter Holemans

von Peter Holemans - am 28.05.2016 08:31
Hi Peter,

That sounds like the ticket. I'll give it a try - Thanks.

von Peter Hite - am 31.05.2016 13:00
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.