Feedback Print

Scriptcase Variables

Field Variables

In Scriptcase the fields are internally treated as local variables php, however, at Scriptcase interface it’s necessary to inform these, using keys, so it’s possible to retrieve or assign values to the application fields.

These fields can be used at Scriptcase events, but will not work from the onScriptInit event because only the events after that will have values in the fields.

In the examples below it’s possible to visualize the operation of the fields.

Retrieving field value:

To assign the field value to a local variable to be used within an event, we can perform the steps as below:

$var_local = {application_field};

To assign the field value to a local variable to be used within an event, we can perform the steps as below:

[variavel_global] = {application_field};

Assigning Value to Field:

To assign a value to the field, we can do assignment in the same way as done with the variables, and if possible, according to the field type:

Field type Text: {field_text} = “This is a sample text”;
Field type Number: {field_number} = 100;

Global Variables (Session Variables)

These are variables that are stored in the application session, these variables can be used to pass parameters through the applications in the project. These variables can be used at any application event.

Unlike the local and field variables, Global variables can be used in the SQL of the applications that allows the manual to be changed, and in the WHERE Clause of the Form application, thus enabling a dynamic use of the applications.

SQL Grid sample
Sample where grid

Sample in the WHERE Clause of the Form
Sample where form

To define a global variable, you only have to enter it in between brackets, for example:


Assigning value to global variable:

[text_variable] = “This global has a text stored in it”;
[number_variable] = “This global has a number stored in it”;

Passing values between applications

To pass values between applications, it is necessary to define the same variable in the applications that will use them, however, in the source application the variable must be defined as Output and in the destination application must be defined as Input.

To change the variable type, go to the menu Application> Global Variables.

Global Variable Settings

After clicking on this menu will show the variables in the application and its settings.

Global Variable Settings

In this configuration screen we have the following configuration options:


In Attributes we can see the variables in our application.


In Value we can see some options and configurations of our variable.

Type: This option defines whether the variable will be input or output.


Reports where the variable was declared by the developer.

Local Variables

Local variables are basically PHP’s own variables. These variables must be set using a $ dollar sign at the beginning and the variable names are case-sensitive.

These variables will only work in events or methods, using a variable in an event it will make it only available in that event.

Variable names follow the same rules as other labels in PHP. A valid variable name begins with a letter or underscore, followed by any number of letters, numbers, or underscores.

Below we can see some examples of local variables:

$text = “This variable stores a Text”;
$number = “This variable stores a number”;

For more information, visit the php variables.