createView (NotesDatabase - JavaScript)

Creates a view.

Defined in

NotesDatabase

Syntax

createView() : NotesView

createView(viewname:string) : NotesView

createView(viewname:string, viewselectionformula:string) : NotesView

createView(viewname:string, viewselectionformula:string, templateview:NotesView) : NotesView

createView(viewname:string, viewselectionformula:string, templateview:NotesView, prohibitdesignrefreshmodifications:boolean) : NotesView

Parameter Description
viewname A name for the view. Defaults to the "(untitled)" view. The view is created even if this name duplicates an existing view.
viewselectionformula A selection formula. Defaults to either:
  • selection formula of the template view
  • "SELECT @All" if no template view exists

If specified, this formula overrides the selection formula of the template view.

templateview An existing view from which the new view is copied. Defaults to either:
  • view checked as "Default design for new folders and views" in the database
  • none if no view in the database is specified as the default design
Note: The template view cannot be of type "Shared, desktop private on first use."
prohibitdesignrefreshmodifications
  • true (default) to prohibit the view design from being refreshed
  • false to allow the view design to be refreshed
Return value Description
NotesView The new view.

Usage

If no template view exists, the new view contains one column with "@DocNumber" as its value. The template view must be accessible to the program, so can be a public view or a private view owned by the effective ID running the agent, but cannot be a private view stored in the desktop.

Examples

This button creates a new view with two views based on another view.
var viewMain:NotesView = database.getView("main");
var viewMod:NotesView = database.createView("modified", "SELECT @All");
var col1:NotesViewColumn = viewMod.copyColumn(viewMain.getColumn(3), 1);
var col2:NotesViewColumn = viewMod.copyColumn(viewMain.getColumn(1), 2);
viewMod.removeColumn(); // remove default # column which is now last column
requestScope.status = "Columns in new view " + viewMod.getName();
var cols = viewMod.getColumns().iterator();
while (cols.hasNext()) {
	var col:NotesViewColumn = cols.next();
	requestScope.status += "\nColumn " + col.getPosition() + " = " + col.getTitle();
}