strange behaviour

Questions, tips and tricks and techniques for scripting in Servoy

strange behaviour

Postby Hans Nieuwenhuis » Sat Feb 09, 2013 2:21 pm

Hi,

I have a login solution in which some global var's are set.

If I declare these globals in my main solution there values are not available in my main solution.

If I don't declare them the values are available.

Is this expected behaviour ???

Regards,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: strange behaviour

Postby mboegem » Sun Feb 10, 2013 12:11 am

Yes, because your login solution is included as a module, it's no problem to use these global vars.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: strange behaviour

Postby Hans Nieuwenhuis » Sun Feb 10, 2013 9:35 am

Thanks, but why do the global vars loose there value when i declare them and do they keep there values when i do not declare them ?
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: strange behaviour

Postby mboegem » Mon Feb 11, 2013 10:16 am

Hans Nieuwenhuis wrote:but why do the global vars loose there value when i declare them and do they keep there values when i do not declare them


As long as you're not authenticated the main solution isn't executed and therefore the declaration of variables not executed.
As soon as they are declared, they will get the initial value as described in the declaration.

I don't know which version you're running, but in 6.x I'd expect Servoy to have buildmarkers on duplicate named global variables.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: strange behaviour

Postby rgansevles » Mon Feb 11, 2013 10:21 am

Hans,

Assuming that your login solution is a module of your main solution and not (also) the other way around, how can the login solution access the global defined in the main solution?
Modules cannot access stuff from their calling solutions/modules.

I guess when you use a global with that name in the login solution, it is not the same global var.
And when switching to the main solution the real global var is used which is new in that scenario.

If you want to keep some state from the login solution to the main solution the global has to be declared in the login solution (or in one of its modules).

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL


Return to Methods

Who is online

Users browsing this forum: No registered users and 6 guests

cron