Direct Variables
Direct variables are values that are read from (or written to) items in the ClearSCADA database. You need to reference direct variables in your Logic programs to allow them to react to values in the database and apply changes to values in the database.
There are several ways of accessing direct variables in your ST programs. The most effective type of access for you to use varies according to what you need to achieve.
Usually, if you need your Logic program to read values from the database or write values to the database, you will use a:
- Variables List (see Using the VAR List to Access Direct Variables).
However, there are some situations in which using an alternative way of accessing the direct variables is more effective:
- If you need to prevent your ST program from using values stored in the cache, you may need to use a VAR list in conjunction with the NOCACHE keyword. For example, you will need to use the NOCACHE keyword if your ST program has values that accumulate with each execution of the program (see Using VAR NOCACHE to Prevent Cached Values Being Used in an ST Program).
- If you need your ST program to reference the same properties for a large number of database items of the same type, you should use a Database Object Structure (see Using Database Object Structures to Access Direct Variables).By using a Database Object Structure, you can reduce the amount of time and effort required to create the references to the database.
- If you need your ST program to access multiple database items that meet certain criteria (but are not named explicitly in the program), you should use an SQL Query to access the database. The SQL Query can be included within your ST program (see Using SQL Queries to Access Direct Variables).
- If you need your ST program to read values from, or write values to an array, you need to use Vectors to access the direct variables (see Using Vectors to Access Direct Variables).
- If you need to access historic values, please refer to Historic Values in ST Programs.
ATTENTION: If a database item's name includes parentheses ( ), you should ensure that each opening parenthesis is paired with a closing parenthesis. If this is not the case, any Logic programs that reference the database item will not compile successfully. For example, a point named "Analog Point (4" or "Analog Point (4))" will generate a compile error message. Multiple sets of parentheses will compile successfully, including nested parentheses. For example, a Logic program can refer to a point named "Analog Point (4)" or "Analog Point (4(x))". For more information, see Limitation for Database Item Names Referenced in Logic Programs in the ClearSCADA Guide to Logic.