Using Application-specific Parameters
When users run an imaged application from the command line, you can let them specify values for parameters that are passed back to the application itself. For example, you can ask the user to indicate a department name when starting the application. You then can use this value to restrict the records that the user sees on various frames of the application.
The -a flag indicates the start of a string of application-specific parameters. You retrieve the values into the application with the CommandLineParameters() function. This function returns a varchar value of the appropriate size (up to n bytes, where n represents the lesser of the maximum configured row size and 32,000 to hold the parameters specified on the command line (up to 126 characters for PCs). After n bytes, any additional characters are truncated.
Note: The -a flag must be the last flag on the command line.
In an application, you can define as many variables as you must hold the values that the user specifies. You then can use these variables any number of times, from any frames or procedures within the application.
If you want to use multiple parameters, be aware that the CommandLineParameters() function always returns a single value—all the parameters concatenated into a single string, with the parameters separated by a single space. You must write your own code for parsing this value into the separate variables for your application to use. The characters that the user enters after the -a flag, including multiple spaces, can be parsed differently by different operating systems.
See the 4GL section of this guide for more information on how this function retrieves parameter values, including an example of 4GL string-parsing code.
Last modified date: 04/03/2024