In addition, you can define "variables" that are independent of a specific object and are assigned to the model. They can be numbers or strings, and even arrays. Such variables can be helpful in EbsScript calculations or in text fields.
There are two types of variables:
Variables are defined by the command menu Extras->Model-Optionss, sheet Profile-Variables and Model-Variables.
In EbsScript, you have access to all quantities that are defined in the model. Once you have performed certain calculations within your EbsScript, you may ask whether it is possible to transfer your EbsScript results back to the model.
For this reason, it is possible to define variables within the model that can be modified either manually with the graphical interface or automatically by EbsScript. Generally, there a two types of variables:
Model variables are independent of profile i.e. they are available in each profile and have the same value in each profile. If you change the value of a global variable in any profile, you can see the changed value in each profile.
Profile-dependent variables are available in each profile as well, but they may have different values in different profiles. If you change the value of a profile-dependent variable in a profile, this change affects only the current profile. Note that the mechanism of inheritance is not active in this context.
The mechanism of definition and assignment of values is the same for global and profile-dependent variables. The "Profile-Variables" window and the "Model-Variables" window both consist of the columns "Name", "Type", "Description", "Additional description", "Class", "Min", "Max" and "Value". The column widths can be adjusted by dragging the separators between the columns in the headline while the left button is kept pressed down. It is not possible to do an alphabetical sorting in this window, but you can access a special row by typing the beginning of the variable name while your cursor is somewhere in the name column.
To create a new variable, click on the field "Click to insert item..". When the field turns red, click again to edit the field and type the name of your variable. Either with the "TAB" key or with the mouse, you can activate the "Type" field where you can define the type of your variable: BOOLEAN (true or false), CHAR (single character, INTEGER, REAL or STRING (sequence of characters)).
In the class field, you can select either "VARIABLE" or "ARRAY". If you define an array, the fields "Min" and "Max" can be edited to define the lower and the upper limits for the array. In the "Value" field you can set the value of a simple variable directly. In case of an array, use the "Click…" button to open the "Change Array" dialog where you can edit the values of your array.
To delete a variable, select the row of the corresponding variable and press the "Delete" key.
To modify a variable, select the corresponding field and make the change. If you change the name, the values will not be changed. If you change the type, the value will be converted, if possible.