GetItemValue (NotesDocument - LotusScript®)

Given the name of an item, returns the value of that item in a document.

Defined in

NotesDocument

Syntax

valueArray = notesDocument .GetItemValue( itemName$ )

Parameters

itemName$

String. The name of an item.

Return value

value

The value or values contained in the specified name. The data type of the value depends on the data type of the item.

Notes® item type

Value return type

Rich text

Array of strings. The text in the item, rendered into plain text

Text or text list (includes Names, Authors, and Readers item types)

Array of strings

Number or number list

Array of doubles

Date-time or range of date-time values

Array of variants of type Date

When GetItemValue returns an array, each element in the array corresponds to a value in the item. If the item contains a single value, the array has just one element.

Usage

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

For text, number, and time-date items, GetItemValue always returns an array, even when there is only a single value in the item. If you know the item contains only a single value, access the first element in the array, which is at index 0. If you know the item contains multiple values, but you don't know how many, iterate over the array elements using the Forall statement.

To get a date-time value as an array of NotesDateTime and NotesDateRange objects, see GetItemValueDateTimeArray.

"Extended class" syntax

You can also access the contents of an item directly, without using GetItemValue. The following two statements are equivalent:

t = lastDoc.GetItemValue( "Topic" )
t = lastDoc.Topic

This syntax lets you access and modify items the same way you access and modify other NotesDocument properties. The return value is the same, that is, an array of values for text, number, or time-date items, and a string for rich text items.

You can set the value of an item with this syntax, too:

mailMemo.Subject = "Update on stock options"
Call mailMemo.Save( False, True )

While this syntax may be adequate for one-time scripts, you should prefer GetItemValue because:

  • The extended syntax is easy to confuse with a method or property of NotesDocument for someone reading your code.
  • Your code may fail if a method or property that conflicts with the item name is added in a future release.
  • GetItemValue is marginally more efficient.

For more information about setting an item value with this syntax, see the AppendItemValue and ReplaceItemValue methods.

Example