在给出“非法括号引用:项目”错误的代理中拥有这行 lotusscript 代码:
Set tempObligor.Facilities.items(Cstr(facilitydoc.requestnum(0))) = tempFacility
Facilities.items 被定义为对象列表。
所以不明白为什么 Notes 8.5 设计器会抛出错误。
同样奇怪的是,这在 Notes 8.0.2 中没有问题。
构成对象的代码如下。
如果您有任何想法,请告诉我。
相信我可以通过使用遍历所有值以寻找匹配项的 FOR 循环来解决问题……但不知道为什么会发生错误让我感到困扰……
Dim tempObligor As Obligor
'This line errs out - does not like () after .items
Set tempObligor.Facilities.items(Cstr(facilitydoc.requestnum(0))) = tempFacility
Class Obligor As CollectableObject
Public Facilities As SortableList
End Class
Class CollectableObject
' STUB
End Class
Class SortableList
Public items List As CollectableObject
Private Sub Sort()
Dim uboundarray As Integer
Dim nextTag As String
Dim x As Integer
Dim sortedArray As Variant
Dim ArrayToSort() As Variant
uboundArray = 0
Forall elem In items
NextTag = Listtag(elem)
Redim Preserve ArrayToSort(uboundArray)
ArrayToSort(uboundArray) = NextTag
uboundArray = uboundArray + 1
End Forall
SortedArray = SortArray(ArrayToSort)
Dim TempList List As CollectableObject
For x = 0 To Ubound(SortedArray)
Set TempList(SortedArray(x)) = items(SortedArray(x))
Next
Erase items
Forall elem In TempList
Set items(Listtag(elem)) = TempList(Listtag(elem))
End Forall
Erase TempList
End Sub
Function SortArray(ArrayToSort) As Variant
Dim NumberOfElements As Integer
Dim temp As String
Dim x As Integer
Dim y As Integer
NumberOfElements = Ubound(ArrayToSort)
If NumberOfElements% = 0 Then
SortArray = ArrayToSort
Exit Function
End If
For x = 0 To (NumberOfElements)
For y = 0 To ( NumberOfElements - x - 1)
If Ucase$(ArrayToSort(y)) > Ucase$(ArrayToSort(y+1)) Then
temp = ArrayToSort(y)
ArrayToSort(y) = ArrayToSort(y+1)
ArrayToSort(y+1) = temp$
End If
Next y
Next x
SortArray = ArrayToSort
End Function
End Class