Env$: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
Line 35: Line 35:
<noinclude>
<noinclude>
[[Category: Internal Functions]]
[[Category: Internal Functions]]
[[Category: Configuration and Environmental Settings]]
</noinclude>
</noinclude>

Revision as of 19:23, 27 April 2013

The Env$(var$) returns the current value of the environment variable var$. The Env$ function can be used to obtain the value of any user-created or system-created environment variable that can be displayed with the operating system's SET (or set) command. To see a list of these variables, enter the SET command with no parameters at the operating system prompt.

The Env$ function is used to retrieve an environmental variable's value which was set with SetEnv or inherited from Windows' environmental variables.

Example:

got1$=env$("UserName")
got2$=env$("GUIMode")

Additionally the status command showing all set environmental variables is:

Status Env

The Env$ internal function can be set by CONFIG SETENV. For example, use the following command to set the value of env$("librarypath"):

config setenv librarypath f:\apps\library\

Operating system ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.

Comments and Examples

As an example, if LOGNAME contains the login name, the following line in a menu program would require a user to log in as "root" to be able to run program PROG14.

00040 if env$("LogName")="root" then chain "Prog14" else goto SHOWMENU

Technical Considerations

  1. Unix / Linux versions of Business Rules require that user-created environment variables be passed by an export command to the operating system before the user enters Business Rules . Otherwise, the values of these variables cannot be returned by ENV$.

Env$("GUIMode")

There is a BR provided Env$ variable called GUIMODE (case insensitive). It's value is either ON or OFF depending on whether BR is in GUI mode. System ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.