Normal Topic Global values in Application Programming (Read 2268 times)
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Global values in Application Programming
Nov 23rd, 2018 at 4:19pm
Print Post Print Post  
I am trying to set a Global Variable in the Application programming so I don't have to repeat code in every form.

Code
Select All
Stat gsDrive as String
var vDrive as String

vDrive = @GetLocalEnvVar("HOMEDRIVE")
IF vDrive = "G:" THEN {vDrive = "C:"}
gsDrive = vDrive
 



Keep getting error message: "Static declarations in functions and subroutines are not allowed"

Does this mean I cannot set a Global Value in the Application Programming?
  
Back to top
 
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Global values in Application Programming
Reply #1 - Nov 24th, 2018 at 11:27pm
Print Post Print Post  
I can't remember but I thought you couldn't assign variables in Global, but you could assign Stats.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Global values in Application Programming
Reply #2 - Nov 26th, 2018 at 2:40pm
Print Post Print Post  
There is a difference between Stats and GlobalValues. You can set GlobalValues in Global code. They are set with the GlobalValue() command. But in your case you want ClientLocalValue(), so that each instance of Sesame has it's own personal one and is not shared application wide.

You can use Stats in GLOBAL CODE and they are a variable that can be used by all programming events on that particular layout.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Global values in Application Programming
Reply #3 - Nov 27th, 2018 at 12:37am
Print Post Print Post  
So, from Ray's comments you could modify your Application code like this?
Code
Select All
Stat gsDrive as String
gsDrive = @GetLocalEnvVar("HOMEDRIVE")

IF gsDrive = "G:" THEN {gsDrive = "C:"}
ClientLocalValue("HomeDrive", gsDrive)

===============
// Get this value in your normal code with @ClientLocalValue("HomeDrive"):
vDrive = @ClientLocalValue("HomeDrive") 



Does this look right Ray?
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Re: Global values in Application Programming
Reply #4 - Nov 27th, 2018 at 6:44am
Print Post Print Post  
Thanks for the ideas,  Bob and Ray.

(Hey,  you guys should hook up for a radio show).
  
Back to top
 
IP Logged