Hi people,
Now we will see how variables work in Scriptcase.
Local Variables
It should be used as a common PHP variable (beginning with $).
$var1 = ‘local’;
It is used in only one event or method. Its scope is finished at the end of the event.
If it is being used in onLoad event it will be used just in that event.
Global Variables
It is used with square brackets
[var2] = ‘global’;
Can be called in any event or method of an application.
Note 1: A local variable can be a global variable if you use sc_set_global
$var3 = ‘testing’; // var3 is a local variable
sc_set_global($var3); // transforming var3 in a global variable
echo [var3] ." global variables"; // Now we can call [var3] in any other event
Session Variables
It is used like a global variable (with square brackets)
[var4] = ‘session’;
But you must access “Application>>Global Variables” to set var4 to be “SESSION”.
Session variables can be called in any event of any application.
If I create it in the login application, so I can call it in any application of my project.
Note 2: Accessing “Application>>Global Variables” you can define if a global/session variable is IN or OUT variable.
If the application is CREATING the variable, so it should be an OUT variable.
If the application is RECEIVING the variable from another one, so it should be an IN variable. (IN is default)
Note 3: Global and Session variables can be reseted using sc_reset_global macro.
sc_reset_global ([var3],[var4]);
Fields
Fields can be called using “curly brackets”.
{field_x} = ‘field_x receive this value’;
{field_y} = [var3];
{field_z} = {field_y};
V?tor Jamil