getItemValue (NotesDocument - JavaScript)

Returns the value of an item.

Defined in

NotesDocument

Syntax

getItemValue(name:string) : java.util.Vector
Parameter Description
name The name of an item.
Return value Description
java.util.Vector The value or values contained in the item. The data type of the value depends on the data type of the item.
Notes® item type Value return type
Rich text java.util.Vector with one string element rendered into plain text
Text (includes Names, Authors, and Readers item types) or text list java.util.Vector with string elements
Number or number list java.util.Vector with double elements
Date-time or range of date-time values java.util.Vector with NotesDateTime and NotesDateRange elements

Each element corresponds to a value in the item. If the item contains a single value, the vector has just one element.

Usage

If multiple items have the same name, this method returns the value of the first item.

If the item has no value, this method returns an empty vector.

If no item with the specified name exists, this method returns an empty vector. It does not throw an exception. Use hasItem to verify the existence of an item.

This property returns the same value(s) for an item as getValues in NotesItem.

Examples

This button gets the value or values of an item in the current document. The user specifies the item name. The button determines the item type and gets values accordingly.
try {

var itemname:string = requestScope.query;
var doc:NotesDocument = currentDocument.getDocument();
if (doc.hasItem(itemname)) {
	var itemvalues:java.util.Vector = doc.getItemValue(itemname);
	var iterator = itemvalues.iterator();
	while (iterator.hasNext()) {
		var itemvalue = iterator.next();
		if ((typeof(itemvalue)).endsWith("string")) {
			requestScope.status += "\n" + itemvalue.left(80);
		} else if ((typeof(itemvalue)).endsWith("number")) {
			requestScope.status += "\n" + itemvalue.toFixed();
		} else if ((typeof(itemvalue)).endsWith("DateTime")) {
			requestScope.status += "\n" + itemvalue.getLocalTime();
		}
	}
}

} catch(e) {
	requestScope.status += "\n" + e.toString();
}