8. Using Vision Advanced Features : Global Components : Define a Global Constant
 
Share this page                  
Define a Global Constant
To define a global constant
1. Select Edit from the menu in the Application Flow Diagram Editor or Visual Query Editor window.
Because the constant definition applies to the entire application, you can select any frame as the current frame.
2. Select Global Components from the list of options.
3. Select Constants from the list of global components.
Vision displays the Edit Application Constants Window as shown in the following figure:
4. Select Create from the menu.
Vision displays the Create an Application Constant pop-up window as shown in the following figure.
5. Enter a name for the constant.
6. Press Tab.
7. Enter an optional Short Remark to describe the constant.
This description appears in the Edit Application Constants window. It also appears as a comment in the code that Vision generates to define the constant.
8. Press Tab.
9. Specify a data type in either of these ways:
Enter a valid Ingres data type. If the type requires a length, specify the length in parentheses. If you do not specify the length, Ingres calculates the length based on the value you enter in the Value field.
Use the ListChoices operation.
Vision displays a list of valid Ingres data types. If the type you select requires a length, enter the length in parentheses after Vision places the data type in the Type field. If you do not specify the length, Ingres calculates the length based on the value you enter in the Value field.
For example, to indicate a char(20) data type, select "char" then add "(20)".
Be sure the data type is consistent with the function of the constant. For example, if the value of the constant is a percentage, use a float data type.
10. Press Tab.
11. Enter a value for the constant.
Be sure that the value is consistent with the data type.
12. Select OK from the menu.
If the value for the constant is longer than the length you specified in the type field, Vision prompts you to truncate the value or to increase the length of the data type. Select the appropriate response.
Vision displays the new constant in the Edit Application Constants window.
13. Select End to return to the window in which you were working.