STRLOOKUP Function
Queries, creates, saves, or modifies a string server database.
Usage
value = STRLOOKUP([name])
Input Parameters
name—(optional) Specifies the string name for the database search. The name parameter is used to query the string database for its associated value.
Returned Value
valueThe returned value depends on the input parameter and/or the use of keywords as shown in Table 16-4: Returned Values.
 
Returned Values
Value Returned
Parameter or Keywords Used
The value associated with the named string, or a default value if the string isn’t found.
name, or name with Default keyword
An integer value of 1 indicating success, or 0 indicating failure.
Add, Load, or Save keywords
Keywords
Add—A string containing a name: value pair to merge into the string database for the current session. If the specified string already exists in the database, the Add keyword takes precedence. If the string specified with the Add keyword doesn’t already exist in the database, it is created.
Default—(Used only if name is specified.) A string containing a default value to be returned, if no match is found in the database for name.
Load—A string specifying the pathname of a file of strings to be loaded, or merged with the existing string database. Strings merged into the database with the Load keyword that match existing strings supercede the existing string definitions in the database.
Save—A string specifying the pathname in which to save the strings currently defined in the string database. If the file specified already exists, the contents will be overwritten.
Discussion
STRLOOKUP provides access to a string database of name: value pairs. The string database is created by loading strings from an existing file with the Load keyword, or changed by merging strings into the existing database using the Add keyword.
String resource files are identified by the application default string (.ads) file extension.
 
note
This function is designed specifically for use in application internationalization, or other customized applications. Internationalization may be achieved by saving all language-specific messages in one file to be accessed using STRLOOKUP.
Examples
In this example code, STRLOOKUP is used to load the contents of the specified file into the string database for the current session.
status = STRLOOKUP(Load=!Dir + '/xres/american/vdatools/wzplot.ads')
The following example illustrates the syntax for merging a name: value pair into the existing string database using the Add keyword.
status = STRLOOKUP(Add='msg_NoSuchFile: No such file')
In this example, STRLOOKUP is used to determine if a specific string exists in the string database, and to obtain the value associated with it if it does. If a matching string name is not found in the string database, the default is set to return the message File OK.
value = STRLOOKUP('msg_FileOK', Default='File OK')
The following example illustrates how to save all strings currently in the string database to a file.
status = STRLOOKUP(Save='myapp.new')
See Also