createColumn (NotesView - JavaScript)

Creates a new column.

Defined in

NotesView

Syntax

createColumn() : NotesViewColumn

createColumn(position:int) : NotesViewColumn

createColumn(position:int, columntitle:string) : NotesViewColumn

createColumn(position:int, columntitle:string, formula:string) : NotesViewColumn

Parameter Description
position The position of the new column where 1 is the first column. Defaults to the last column.
columntitle The column title.
formula The column formula. @DocNumber is the default.
Return value Description
NotesViewColumn The new column.

Usage

Positioning is 1-based. This differs from the vector returned by Columns, which is 0-based.

Examples

This button creates a new view, deletes its columns, copies a column from another view, and creates two columns.
var v:NotesView = database.getView("main");
// Create "dates" view and remove all columns
var main:NotesView = database.getView("main");
var dates:NotesView = database.createView("dates", "SELECT @All");
while (dates.getColumnCount() > 0) {
	dates.removeColumn(dates.getColumnCount());
}
requestScope.status = "New view " + dates.getName();

// Copy column 1 from "main" to "dates"
var col1:NotesViewColumn = dates.copyColumn(main.getColumn(1), 1);
requestScope.status += "\n" +
	col1.getPosition() + " " + col1.getTitle() + " " + col1.getFormula();
var col2:NotesViewColumn = dates.createColumn(
dates.getColumnCount() + 1, "Created on", "@Created");
requestScope.status += "\n" +
	col2.getPosition() + " " + col2.getTitle() + " " + col2.getFormula();
var col3:NotesViewColumn = dates.createColumn(
dates.getColumnCount() + 1, "Last modified on", "@Modified");
requestScope.status += "\n" +
	col3.getPosition() + " " + col3.getTitle() + " " + col3.getFormula();