8. Using Vision Advanced Features : Using Local Variables
 
Share this page                  
Using Local Variables
In addition to the fields that appear on a frame's form, you can create hidden fields for Append, Browse, Update, and Menu frames. A hidden field holds information that the user cannot see.
In Vision, hidden fields are known as local variables, because you create them and set their values locally for an individual frame. You can create a maximum of fifty local components (local variables and local procedures) for each frame.
After you create a local variable as described below, you write escape code to define its value. You then can use the local variable:
In a query restriction on a Browse or Update frame
In an assigned value for a field on an Append frame
You can assign a value to a non-displayed field on an Append frame without having to define it as a local variable.
In a parameter that you pass to another frame
In additional escape code
Parameters and escape codes are discussed in other sections of this chapter.
For example, create a local variable called "h_date" to keep track of the current date and time. The following escape code uses standard Ingres functions to define its value as the current time:
h_date = date ('now');
Use this local variable in escape code to record each time that a user changes a record on an Update frame. See How Writing Escape Code Works for more information about using escape code in your applications.
You also can create local variables based on existing columns or table-field columns in the Master or Detail table for a frame. For more information, see Change the Default Form Display.