copyColumn (NotesView - JavaScript)

Creates a new column by copying an existing one.

Defined in

NotesView

Syntax

copyColumn(sourcecolumn:string) : NotesViewColumn

copyColumn(sourcecolumn:string, destinationindex:int) : NotesViewColumn

copyColumn(sourcecolumn:NotesViewColumn) : NotesViewColumn

copyColumn(sourcecolumn:NotesViewColumn, destinationindex:int) : NotesViewColumn

copyColumn(sourcecolumn:int) : NotesViewColumn

copyColumn(sourcecolumn:int, destinationindex:int) : NotesViewColumn

Parameter Description
sourcecolumn:string The title of the view column to be copied. It must be in the same view.
sourcecolumn:NotesViewColumn The view column to be copied.
sourcecolumn:int The position of the view column to be copied. It must be in the same view where 1 is the first column.
int destinationindex The position of the new column where 1 is the first column. Defaults to the last column.
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();