In LotusScript, arrays have a upper boundary limit of 32,767. Specifically, the subscript range may be from -32787 to 32,767. If you try declare a larger Array size, you receive the following error when saving the code:
“Illegal array bound for
If you attempt to use ReDim to redimension an Array beyond the bounds, the following error will occur:
“Overflow”
Depending on how the bound value is set, the above error can occur when saving the code or when executing the code.
You may use a List variable to work around the Array size limits in LotusScript. Lists are automatically resized as elements are added or removed. Lists differ from Arrays in that they are not categorized by an integer value, but instead by a List tag. The List tag can be any string.
In cases where you are converting from using an Array to a List, it may be easiest to use a string representation of a integer value for the List tag. This can easily be done using the Cstr function.
For example, if you used the following construction with an Array:
Dim i As Long
Dim arraytest() As String
For i = 0 To 100000
Redim Preserve arraytest(i)
arraytest(i) = ...
Next
The List equivalent usage would be:
Dim i As Long
Dim mylist List As String
For i = 0 To 100000
mylist(Cstr(i)) = ...
Next
Lists only allow unique List tag values. This can be beneficial in some application designs.
For example, if you want to have a unique List entry for each part number, you could use the part number as the List tag. You could note how much inventory you had of particular parts by using the part number as the List tag and the number of parts as the List entry value:
Dim parts List as Integer
parts("N001")=10
parts("N002")=12
The IsElements function can be used to determine if a List contains a List tag:
If (Iselement(parts("N003")) = False) Then
'Returns False if there is no list tag "N003"
End If
NOTE: The following usage is allowed even if the List tag did not previously exist. The result is that the List entry for “N004” in the parts List will have a value of 1.
parts("N004")=parts("N004")+1
The above construction would be useful when decrementing a List value by a certain amount. For example, if you wanted to decrement the number of parts by an order size:
If ordersize>parts("N004") Then
'Not enough parts on hand...
Else
'Have enough parts, decrement inventory by ordersize
parts("N004")=parts("N004")-ordersize
End If
Lotus Notes KnowledgeBase document #1221020