Equinox Online Help - Language Reference - A to Z

Home

SetUserContext

Applies to
SyntaxSetUserContext [LoginName, flags]
Action[Statement] Changes the login and associated data in the local process.
ScopeUsable anywhere.
Notes

This statement obtains a password from the operator if required, and changes the login details to that of LoginName. It loads appropriate permissions for that user, and optionally local workarea values.

The LoginName parameter is a string containing the login name, or "" for the Default User Login. If the parameter is omitted, Equinox returns the login state to that of the operator's first login.

The flags parameter may take the following values; add the values together to combine them.

  • 1 Ask for a password from the operator (see below).
  • 2 Load local workareas for LoginName
  • 4 Save local workareas for the current user context

If LoginName has more permissions than the current user, the ask for password flag is set. If the ask for password flag is set in a remote process, the statement returns an error; the flag has no effect in a web page.

This statement cannot be used to load the System Supervisor context.

CategoryUser, groups and ESS
See Also Execute, ExecuteSetMode, SetUserGroup
Example

This example sets the user context for user Jack Beanstalk, runs a report, then resets the user context back to the default again:

SetUserContext "JB"
execute report "plant.rep"
SetUserContext

This example gets Jack's current status as stored in a local workarea for his user login, and preserves local workareas for the current user.

string vsStatus

SetUserContext "JB", 6
vsStatus = lwCurrentStatus
SetUserContext , 2