Return the user name used to log on to a database path.

$user { (Path) }


Path—DBMS path name, without leading dollar sign ($).

Return Values

  • User name used to log on to Path. (Uniface does not support spaces in user names; any characters following a space are ignored.)
  • If Path is omitted:
    • For Windows, $user returns the value of user in [user] section in the usys.ini.
    • For other operating systems, it returns the value of the environment variable USER.
  • Empty string (""), if the user INI setting or USER environment variable is empty.

In a Web environment, if Path is omitted, $user returns:

  • Authenticated user name used when connecting to the Web server
  • Empty string (""), if no user authentication has taken place between server and browser or if there is a license problem

    (Within the Web environment, Uniface does support spaces in user names; this is handled by the authentication process.)


Allowed in all Uniface component types.


The $user function is supported only for DBMSs which require a user name to log on and for those operating systems which support a user name. It is not supported for network drivers.

However, if a database path name is assigned to a network path, the network driver is requested to open the path. The network path may also be re-assigned to another server. As long as a server in the chain assigns the path name to a database driver, this is supported.

$user and $password are often used to construct the logon string given to the Proc open statement. For example, if you want to close and then open a database, you can use $user and $password to get these values before closing. Then use these values to open the database. This avoids re-prompting the user for information they may have already entered.

Logging Modification Information About an Occurrence

The following example uses the $user function in the Write trigger. The example logs information about which user updated or created a particular occurrence.

; Write trigger
; $dbocc = 0 when the occurrence has
; just been created

if ($dbocc = 0)
   CREATED_BY = $user
   CREATED_DATE = $date
   UPDATED_BY = $user