Getting and setting environment variables

You can set and retrieve the values of the environment variables in the notes.ini file (Windows, OS/2, and UNIX).

  • @SetEnvironment(variable; value) sets a named variable to the specified value. You can also use the ENVIRONMENT keyword and the two-parameter form of @Environment.
  • @Environment(variable) retrieves the value of a named variable.

Environment values are text. Non-text values must be converted before being set and after being retrieved.

User environment variables are prepended with the $ character. If you add an environment variable with an editor or LotusScript®, for example, and want to retrieve it with @Environment, the first character must be $.

Be sure you know which notes.ini file is affected by your formula. If the formula is in a database on a server, the formula runs on the server in the following cases: replication formula, agent for which the trigger is "After new mail has arrived" or "On schedule," selection formula, or column formula. Otherwise, the formula runs on the user's workstation. Replica copies access different NOTES.INI files, depending on which server or workstation contains the replica copy. Server access is subject to administrative restrictions.

Some uses for environment variables include the following:

  • Pass temporary data among different formulas and databases
  • Generate sequential numbers for one user