Arrays and Indexes

The default for array indexes in LotusScript® is 0 based. For example, elements of an array are specified as Elem(0), Elem(1), Elem(2), etc. The "Option Base n" LotusScript® option lets you make the default lower bound of an unspecified array something other than 0. The Lotus® Connector LotusScript® Extensions (LC LSX) do not support this syntax. It is recommended, for consistency, that within scripts which use an LC LSX, such as the Lotus® connectors, this option not be used.

Many Lotus® connector class methods operate on multi-value data. Class methods include the List methods of LCStream, the Get and Set methods of LCField and LCFieldlist, as well as the Fetch, Insert, Update, and Remove methods of LCConnection. These operations are counted from 1. For example, fields of a fieldlist are specified as MyFieldList.GetField (1), MyFieldList.GetField (2), MyFieldList.GetField (3),...and so on. Unlike dimensioned arrays which default to zero based, and LSX generated arrays which are always zero based, these class methods require an index counted from 1. In some cases, you will access the same data item with a zero-based array index, and with a one-based index method argument, depending on whether you choose to access it with a method or with a property that returns an array value.

It is possible to assign a LotusScript® array to a multi-value object such as a LCField. It is important that the array not contain more elements than the LCField object will store, as this will cause an overflow error. For example, 5 long integers may be assigned to an LCField as follows:

Dim numbers(4) as Long  ' numbers(0, numbers(1), ... numbers(4)
Dim field as new LCField (LCTYPE_INT, 5)

...
field.Value = numbers