replaceItemValue (NotesXspDocument - JavaScript)

Replaces the value of an item.

Syntax

replaceItemValue(fieldName:string, value:any) : void
Parameter Description
fieldName The name of the item.
value The value of the item.

Usage

This method replaces all items of the specified name with one new item, which is assigned the specified value. If the document does not contain an item with the specified name, this method creates a new item and adds it to the document.

The data type of the item depends on the input value: strings go to text; integers and doubles go to numbers, and dates go to date/time values.

The input value can be an array or vector for a multi-value item.

You must save (NotesXspDocument - JavaScript) the document for the change to take effect in the data store.

Examples

This button increments the value of an edit box by 1 and saves the new value.
document1.replaceItemValue("counter", document1.getItemValueInteger("counter") + 1;
document1.save();
This button sets values for a multi-value edit box without saving them.
var n = new Array(22, 33, 44);
document1.replaceItemValue("number", n);
This button sets values for a multi-value edit box without saving them.
var n = new java.util.Vector();
n.addElement(22);
n.addElement(33);
n.addElement(44);
document1.replaceItemValue("number", n);