Variables STATIC
STATIC variable objects store up to 5 values for one or more named keys. You can set the values manually, with a script element or with a condition action.
You define and enter the values for static variables in two pages. On the Variables main page you can set up to five values for the variable. On the Attributes page you define the variable itself, that is, you determine its format and settings as well as what will happen if the variable value is not found.
This topic provides the following information:
- Setting variable values on the Variables page
- Defining the Variable settings on the Attributes page
- Specifying Data & Formatting settings
- Specifying the Variable settings
- Specifying the Script Access settings
- Reading variable values via GET_VAR
- Retrieving variable values via PREP_PROCESS_VAR
- Adding, editing, deleting variable values with Script objects
Variables Page - Setting Values for Existing Static Variable Objects
You set static variable objects' values:
- By manually entering them.
Note: Case-sensitive keys are supported. Example: Add the keys "test" and "TEST". If the database is case sensitive, it will save both keys, otherwise, the second entry will replace the first one.
- Using the Cell Editor window. You open the Cell Editor window by clicking the icon for a cell. When cell text is on multiple lines, you must edit it in the Cell Editor window.
- By defining a SET VARIABLE or CLEAR VARIABLE condition action for a Workflow task. However, you cannot define a new VARA object with a condition action.
The following script elements are available for STATIC and XML variables:
- :PUT_VAR - Stores values in static variables.
- :PUT_VAR_COL - Stores a value in a specific column of a static Variable object.
- :DELETE_VAR - Deletes one or all values of a static variable.
Manually Entering Static Values
Each table line entry is composed of a key plus up to 5 values. The allowable data depends on the data type and scope settings specified in the Variables Settings section.
Note that the key must not start with a & character. Otherwise, you can save the Variable object but an error will occur when an attempt is made to access these lines via script.
A key can include a maximum of 200 characters.
The following value ranges are allowed depending on the selected data type selected in the Data Type field in the Data & Formatting section.
Data Type |
Content Length |
---|---|
String |
Unlimited If the Limit text length checkbox in the Data & Formatting section is selected , this restriction only affects the first value column. |
Number |
Between 0 and 2147483647. |
Timestamp |
Date and time value depending on the output format. |
Time | Time value depending on the output format. |
Date | Date value depending on the output format. |
The values are sorted according to the settings that have been made in the Attributes tab. By default, the Key column is sorted in an ascending order.
Working in the Variables Table
To: | Do this: |
---|---|
Add a row to the table |
Click in the appropriate section. Click the cells in the table to edit their values. |
Edit a cell in table row |
Click the cell in the table and edit its value. |
Delete one of more rows to the table |
Check the checkbox for the row(s) and click . |
Delete all rows to the table |
Check the checkbox column header and click . |
Cut one or more rows and them to the AWI clipboard |
Check the checkbox for the row(s) and click . |
Copy one or more rows and them to the AWI clipboard |
Check the checkbox for the row(s) and click . |
Paste row(s) from the AWI clipboard to the bottom of the table |
Click . |
An editor is available for the value columns of static VARA objects. This provides simple and user-friendly content editing. The editor is helpful particularly for changing long values.
Attributes Page - Defining the Variable Object
Specifying Data & Formatting Settings
Field |
Description |
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Data Type |
The data type decides the format of the variable's values in the first value column. The data type "Text" is always used for all other value columns.
The exact format of the selected data type (with the exception of "String") can be determined in the Output Format field. The data type of the values that are available in the first column is checked. The variable's data type must match the data type of the first column returned by the SQL statements when you use the sources "SQL" or "SQL internally". Data can also be processed using specific SQL statements. An error occurs if static variables should be stored or dynamic variables are accessed and the data types do not match. Note the following if you change the data type of static Variable objects that already include values:
The data type of variables with the type "Multi", "SQL", or "SQL internally" can be changed at any time. The data type of the script variable in question ("float", "signed", "unsigned", or "string") is irrelevant in values that have been retrieved from Variable objects with the data type "Number" when using the script element GET_VAR. The value can always be stored. Algebraic signs and decimal places are removed if they are not supported by the script variable's data type. The values are always passed on to the script as a "string" if a different data type has been specified in the Variable object. |
|||||||||||||||
Output Format |
This setting defines the format that should be used to store values in the Variable object (source: static variables) or to retrieve values from the data source (dynamic variables). The contents of this selection menu depend on the data type. Several different formats are available for each data type (except for the String type). The output format only refers to the first column. In static variables, this is the column Value 1; in Database and Multi variables, it is the first basic column. Note that Multi variables use the first basic column as their reference column. This means that the source variable's output format can affect the retrieved values. The output format of static variables for a particular datatype can be changed at any time. In doing so, the values are converted to the new format. If the values do not match the old format, they cannot be converted to a new format. The format that is used to enter value in static variables is irrelevant unless it is an AE-supported format of the data type in question. The values are then converted to the relevant output format. The data type "Text" does not show this combo box.
Some date formats include RR as a placeholder for the abbreviated year. Having both YY and RR accommodates different century-counting conventions based on the two digits of the abbreviated year value. For example: For example: The time value for the data type "Time" or "Timestamp" must be a 4 or 6-digit number. Decimal places are removed. 4-digit numbers are converted to hours and minutes. Examples: Data type: Timestamp |
|||||||||||||||
Set min. value Min. value |
Enforces a minimum value. The data type "Text" does not show these fields. |
|||||||||||||||
Set max. value Max value |
Enforces a maximum value. The data type "Text" does not show these fields. |
|||||||||||||||
Limit text length Max. Text Length |
Enforces a maximum character length. Allowed values: 1 to 1024 If this option is deactivated, there is no limit. The Key column of VARA objects has a maximum limit of 200 characters. This limit always exists and cannot be increased or deactivated. The result column of dynamic variables has no limit. The length depends on the value columns. In static and dynamic variables, this limit refers to the first value column. The Key or result column is not checked. Values that exceed the maximum length are excluded. Only the data type "Text" shows these fields. |
|||||||||||||||
Force upper case |
Lower case letters that are used in variable values are automatically converted to upper case. This only affects the first value column. Only the data type "Text" shows this field. |
|||||||||||||||
Sort by column |
Specifies the column whose values are used to sort the entries. Possible options: Key, 1, 2, 3, 4, or 5 |
|||||||||||||||
Sort order |
Type of sorting. Possible options: Descending or ascending The underlying type of sorting such as binary or alphabetic, depends on what is defined in your database. |
Specifying the Variable Settings
Field |
Description |
|||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Type | This read-only field shows STATIC as the variable type. You determine the variable type when you create the object. It cannot be changed once the variable is defined. | |||||||||||||||||||||||||||||||||||||||
Scope |
This setting can be used to simplify the script that writes values to variables or reads them. Usually, the key must be specified as a parameter in the script element :PUT_VAR or GET_VAR. However, this makes it difficult to ensure that values are stored with unique keys. By specifying a particular scope, you can simplify design of scripts that write to or read from the variable. For all values of scope except Freely selected, the key is optional, and the default key used to access the variable if no key is specified depends on the characteristics of the task that is accessing the variable.
If the VARA object has the scope Freely selected, you must specify the key when writing to or reading from the VARA object. :SET &VARA_NAME# = "UC0.MAL.TEST#1_1.VARA_STATIC_USERNAME" :PUT_VAR &VARA_NAME#, &$USER#, "Mercury", "Venus", "Earth", "Mars", "Jupiter" :SET &VALUE# = GET_VAR(&VARA_NAME#, &$USER# ,1) :PRINT "Value: &Value#" If the VARA object has the scope User - each user name, you can omit the key when accessing the VARA object. :SET &VARA_NAME# = "UC0.MAL.TEST#1_1.VARA_STATIC_USERNAME" :PUT_VAR &VARA_NAME#, , "Mercury", "Venus", "Earth", "Mars", "Jupiter" :SET &VALUE# = GET_VAR(&VARA_NAME#, &$USER# ,1) :PRINT "Value: &Value#" The two scopes that are more useful are User session - each user session and Workflow session - each workflow session. With these two scopes, the default key that is used if none is specified is user session ID or the workflow run ID, respectively. And importantly, with these two scopes, the rows are deleted when the corresponding run ID is deactivated. For example, let’s say you want to store some information in a VARA object as long as a user is logged in, but remove the information when the user logs out. You can set the scope of the VARA object to User session - each user session, and put values into the VARA object without specifying a key as shown below. :SET &VARA_NAME# = "UC0.MAL.TEST#1_1.VARA_STATIC_USERSESSION" :PUT_VAR &VARA_NAME#, , "Mercury", "Venus", "Earth", "Mars", "Jupiter" :SET &VALUE# = GET_VAR(&VARA_NAME#, &$USER# ,1) :PRINT "Value: &Value#" They key used to write the values will be the session ID of the user who runs the script. In this example, running the script caused the following row to be added to the VARA object:
1168010 is the user's session ID. Users' session IDs are visible under Users in the Administration perspective. As soon as the user logs out, this row is removed from the VARA object. The scope Workflow session - each workflow session works in a similar way. Any row written to such a VARA object (without a key specified) will be automatically removed as soon as the executing workflow is deactivated. |
Specifying Script Access Settings
You can specify what happens if a key is not found with the If key not found radio buttons.
To: |
Choose: |
---|---|
Have an error message displayed if an object attempts to access an item that is not available at runtime via script | Return error |
Not use the result of output format of when it is " " | Return initial values |
Reading Variable Object Values with the GET_VAR Script Function
The values of static and dynamic Variable objects can be read using the script function GET_VAR.
Retrieving a List of Variable Object Values with the PREP_PROCESS_VAR Script Function
Use the script function PREP_PROCESS_VAR to access all or several particular entries of a variable. This prepares the processing of a data sequence.
Adding, Editing, and Deleting Static Variable Objects with Script Elements
In addition to the manual handling of static Variable objects, you can also use the following script elements:
- CREATE_OBJECT - Creates a new static Variable object.
- MODIFY_OBJECT - Changes the attributes of a static Variable object.
- REMOVE_OBJECT - Deletes a Variable object.