Examples: Accessing the user environment

  1. This view selection formula limits the view to documents where the From_1 field matches the name of the current user. Both From_1 and @UserName are reduced to the common name portion of the hierarchical name to better ensure a match.
    SELECT @Name([CN]; @UserName) = @Name([CN]; From_1)
  2. In this column formula, the @Name function extracts the common name from the "From" field.
    Subject + "  (" + @Name([CN]; From) + @DocDescendants(")"; ", % response)"; ", % responses)")
  3. This formula displays information about the user environment. The return value from @MailDbName is imploded because it is a 2-element list containing server name and path name.
    @Prompt([Ok]; "User name"; @Name([CN]; @UserName));
    @Prompt([Ok]; "Mail database"; @Implode(@MailDbName));
    @Prompt([Ok]; "Platform"; @Platform);
    @Prompt([Ok]; "Notes version"; @Version)
  4. This is the formula for the first column in the "By Author" view. It converts the From field, which typically contains a distinguished name, to the form last name, comma, first name.
    AuthorName := @If(!@IsAvailable(From);"Anonymous";@Name([CN]; From));
    Name := @Trim(@Word(AuthorName; "("; 1));
    LastName := @RightBack(Name; " ");
    FirstName := @LeftBack(Name; " ");
    CombinedName := LastName + ", " + FirstName;
    @If(CombinedName = ", "; Name; CombinedName)
  5. This is the input validation formula for the "Password" field on a form. The author can see the password as it is being typed, but when the document is saved, the password is encoded and cannot be read.
    @Password(Password)