To access the Variables database, select:
The following screen is displayed:
|
Enter a name string for the variable or symbolic constant to be defined. Enter a real number to define a real constant. |
|
|
Indicate whether this record should belong to a group. This option is for convenience in sorting variables in the various pick lists (variables are sorted first by Group and then by record name). It does not affect the behavior of the variable. The Variables Index pop-up shows all local-to-sequence variables. It also displays the sequence and group names with lines between each group for clarity. |
|
|
Enter a description of the variable. |
|
|
Displays the value defined for the variable. If the data type selected is an AIM variable (string or numeric), this field is also used to enter the value. Question marks in the value field indicate that the variable has not been defined. |
|
|
Displays statistical information. See Statistics for details. |
|
|
Define the data type and units for this record. The default data type is numeric - AIM variable. Click Define to define a different data type. |
|
Define the data type and units for this record. The default data type is numeric - AIM variable. Click Define to define a different data type. |
|
|
This area defines the sequences that will have access to the variable (known as variable scope). If the record being accessed is in a Variables database which is part of a resource module, the variable can be: Local to module Local to sequence |
|
|
Select Read to allow DDE read access to the variable information by an external WindowsTM application such as Microsoft Excel.TM Select Write to allow DDE write access to the variable information by an external WindowsTM application such as Microsoft Excel.TM
|
|
| 9 |
The following Definition items are displayed based on the data type selected: Read/write Allows read/write access to the variable record. Read only Allows read-only access to the variable record. Output signal number Global only Refers to the Database field. Database: The type of the database accessed by a numeric or string valued Database field variable. Record: The record number to access in the specified database. If this field is left blank, the system accesses the last record selected by the SELECT_VAR_REC statement. See the SELECT_VAR_REC Statement for details. Field: The field name to access in the specified database. Index: The index number that corresponds to the specified field name in the database. Result: For numeric - Vision result data type only. Displays the result of the specified vision record. You must supply the vision record name (in the Record field) or a linking error will be reported. Value: For constants and input/output signals, enter the value for this variable. This value cannot be changed except by editing it from the variable record. |
In most places, AIM allows you to specify string or numeric values interchangeably. If you use a string-type variable where AIM expects a numeric value, AIM uses the V+ VAL( ) function to extract the leading number from the string and uses that value in the computation. If the string does not begin with a number, AIM uses zero. If you use a numeric value where AIM expects a string, AIM uses the V+ default numeric encoding (/D format) to create a string value (except that there is no leading blank in the string). The computation continues with that string. This feature is illustrated in the following example:
Assume we have the numeric variables n1, n2, and n3, and the string variable s1. You can write a sequence to set n3 equal to the numeric value 12:
SET n1 = 1 SET n2 = 2 SETS s1 = n1+n2 ;Concatenate the string SET n3 = s1 ;Convert the string value to a numeric value
This statement dynamically selects a database record for use by the variable database for the current runtime task.
SELECT_VAR_REC --database-- {GLOBAL --yes/no--} RECORD
--string_var-- {STATUS --o_variable--}
Double-click --database-- to enter a standard database name for a runtime database. If GLOBAL is set to "yes", the global database of the specified type is used even if there is a database of this type in the current module.
RECORD --string_var-- is the name of a string variable that contains the name of the record to be found. If the record is found, STATUS --o_variable-- is set to TRUE; otherwise, it is FALSE.
Note that a different record may be selected for each database type. The selection made by each runtime task is independent of all others.