$user
Return the user name used to log on to a database path.
$user { (
Path)
}
Example: CREATED_BY = $user
Parameters
Parameter | Data Type | Description |
---|---|---|
Path | Literal |
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.)
Use
Allowed in all component types.
Description
The $user function is supported for databases that require a user name to log in. 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 ProcScript 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 else UPDATED_BY = $user endif write