0

在给出“非法括号引用:项目”错误的代理中拥有这行 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 
4

1 回答 1

2

我将您的代码粘贴到 ScriptLibrary 中。起初我得到了同样的错误。然后我注意到类Obligor的类定义中还有另一个类型为“引用出现在声明之前”的错误。您的类 Obligor 是 CollectableObject 类型。Domino Designer 似乎在定义 CollectableObject 之前就对其进行了引用这一事实存在问题。因此,您应该将类​​ Obligor 放在该类定义之后,然后您的代码应该可以工作(尽管我必须在 initilize 中移动前两行)。

于 2012-11-13T21:22:02.473 回答