Was this helpful?
Using Alternate Sets of Global Constant Values
Your application typically uses the default set of global constant values defined in the application. You can set up alternate values for the global constants. For example, you can define and use constants for all strings you use in an application. You can create one set for each language you want to use.
The default set of constant values is stored in the database. You can create alternate sets of constant values and store them in files. You can override the default constants by specifying the file name before running an application or creating an image of an application.
When a global constant file is specified before running the application or creating an image, the values in the constant file override the default values stored in the database. The values in the constants file are in effect until you clear the field, specify a different filename, or edit a different application.
Specify a Global Constants File
You can specify a global constants file when you use the imageapp command or when you run the application image. You can also specify a global constants file within ABF, before choosing Go or Image from the menu.
To specify a global constants file within ABF
1. Select Utilities from the menu in the Edit an Application window or the Applications Catalog window.
2. Select ConstantsFile from the menu.
3. Specify a filename in the Global Constants File Name field.
4. Select End.
5. To run the application with the specified constants file:
a. Select End.
b. Select Go.
To create an image with the specified constants file, select Image.
Create an Alternate Global Constants File
You can create a global constants file with your system editor, or copy the default global constant values (that you defined through the Edit Global Constants window) into a file.
To create an alternate set of global constants from the default set
1. Select Utilities from the menu in the Applications Catalog window or Application Flow Diagram Editor.
2. Select ConstantsFile from the menu.
3. Specify a filename in the Global Constants File Name field.
4. Select Create to copy the default global constants into a file.
To create an alternate set of global constants with your system editor
Create and edit a file with the following format:
A constant name, which must begin in column 1.
The character : or =. White space can appear on either side of this character.
A value for the constant. The value can continue across multiple lines, but continuation lines must begin with a space, or tab.
For example:
menu1: 'This is the first menu item'
menu2 = 'Menu2 is the second menu item'
The file can also contain comments beginning with a # character. For more information about the global constants file format, see the SQL Reference Guide section on the PM file format.
Edit an Alternate Set of Global Constants
You change the alternate set of global constant values by editing the constants file. You cannot edit the alternate set of values through the Edit Global Constants window. You can edit the file with your system editor, from your operating system or from within Vision.
To edit the file from within Vision
1. Select Utilities from the menu in the Applications Catalog window or Application Flow Diagram Editor.
2. Select ConstantsFile from the menu.
3. Specify a filename in the Global Constants File Name field.
4. Select Edit from the menu to edit the specified file.
When you edit or destroy a constant in one file, it does not affect the constants in another file, or the default values in the database.
Compatibility with Previous ABF Releases
Prior to the current release of ABF, specify alternate languages in the Edit Global Constants window. Multiple sets of language-dependent constants values were stored in the database. In this release, only one set of global constants values are stored in the database, and alternate sets are stored in separate files. If you have a previous release of the database that contains multiple language values, the values are retained in the catalogs.
To convert global constants to the new format, create a file of global constants from the default set, as described in Create an Alternate Global Constants File. ABF creates a file with the global constants values separated by language, as shown in the example below. The data type is provided as a comment. You can then copy each set of values into its own global constants file.
# PM readable Global Constant File
#
# Application name: ccf
#
#BEGIN default
 cons1 ='English' #char(7)
 cons2 ='yards ' #char(6)
 cons3 ='Fahr' #char(4)
 #END default
#BEGIN French
 cons1 ='French ' #char(7)
cons2 ='meters' #char(6)
cons3 ='Cels' #char(4)
#END French
#BEGIN german
 cons1 ='German ' #char(7)
cons2 ='meters' #char(6)
cons3 ='Cels' #char(4)
#END german

# Number of Global Constants: 3
Last modified date: 11/09/2022