appendItemValue (Document - Java)

Creates a new item in a document and optionally sets the item value.

Note: In general, replaceItemValue is favored over appendItemValue. If an item of the same name already exists in a document, appendItemValue creates a second item of the same name, and the duplicate items are not accessible except through a work-around. If you are creating a new document, appendItemValue is safe.

Defined in

Document

Syntax

public Item appendItemValue(String name)
    throws NotesException
public Item appendItemValue(String name, int value)
    throws NotesException
public Item appendItemValue(String name, double value)
    throws NotesException
public Item appendItemValue(String name, Object value)
    throws NotesException

Parameters

String name

The name of the new item.

int value

The value of the new item.

double value

The value of the new item.

Object value

The value of the new item. The data type of the new item depends upon the data type of the value that you place in it.

Data type of value

Resulting item

String

Text

Integer

Number

Double

Number

DateTime

Date-time item

java.util.Vector with String, Integer, Double, or DateTime elements

Multi-value text, number, or date-time item

Item

Same data type as the Item

Return value

Item

The new item.

Usage

To keep the new item, you call save after calling appendItemValue.

If the document already has an item called name, appendItemValue does not replace it. Instead, it creates another item of the same name and gives it the value you specify.

Example