Gobal Variables in SC

Hello…
What is the best way to handle global variables in SC?
Usually, in app_login, I create and initialize some global variables.
But if at some point in the procedure I do not make an echo for each variable, they are not accessible to the rest of the applications…
Thank you so much!
Greetings…

Hola…
Cual es la mejor manera de manejar las variables globales en SC?
Habitualmente, el en app_login, creo e inicializo algunas variables globales.
Pero si en algún punto del procedimiento no hago un echo para cada variable, las mismas no son accesibles al resto de las aplicaciones…
Muchas gracias!
Saludos…

[variable_name] = “value”;

then you should set it to session scope in:
image

Hello.
It doesn’t work well. There are times where it takes the variable correctly, and other times it loses value…
It only works well if I do the echo…
Thanks!

Hi
put an example how you setup one global variable and when

Then an example about how you use it

This is in the app_login Security App.

In application, Global Variables
image

in OnLoad
[Cod_Cliente] = 0;

In OnValidate, after a “Select”
[Cod_Cliente] = {rs[0][4]};

Then, to use the variable in the rest of apps, i need
echo [Cod_Cliente]
after the last asignation

Hi
try this in app_Login
$Cod_Cliente=0;
sc_set_global($Cod_Cliente);

That way, it also fails…

do you have a database field name with the same name Cod_Cliente ?
try with other variable name, $vCod_Cliente

yes, in my database i found a field Cod_Cliente… i try.
Thanks!!!