2013-07-16 3 views
0

열을 선택하면 행을 표시하는 버튼이 있습니다. 하지만 문제가 생겨서 현장에서 2 번째 가치를 얻지 못했습니다. 예를 들어 생일을 선택했지만 값이 같은 항목이 두 개 (예 : 1990 년 1 월 1 일) 인 경우 두 번째 항목을 보지 않고 필드의 첫 번째 항목 행만 표시합니다. 너 나 좀 도와 줄 수있어?Lotusscript : 다음 배열 색인을 얻지 못함

Sub Getvalue 
Dim uidoc As NotesUIDocument 
Dim ws As New NotesUIWorkspace 
Dim printcolumn As String 
Dim columnList() As String 
Dim y As Integer 

'-- print column -- 
For a = 0 To 10  
    setfield = "Untitled" & x 
    Set uidoc = ws.CurrentDocument 
    printfield = uidoc.FieldGetText(setfield) 

    Redim Preserve columnList(11) 
    columnList(a) = printfield  
    x = x + 10  
Next  

printcolumn = ws.Prompt(4,"Column List", "Select:", , columnList)  

indexresult = (Arraygetindex(columnList, printcolumn)) + 1 

'-- print row -- 
y = (indexresult*10) + 1 

For b = 0 To 9 
    setrowfield = "Untitled" & y 
    Set uidoc = ws.CurrentDocument 
    printrowfield = uidoc.FieldGetText(setrowfield) 

    Redim Preserve rowList(10) 
    rowList(b) = printrowfield 
    y = y + 1  

Next  
printrow = ws.Prompt (4,"Row List", "", ,rowList) 

'-- for duplicates -- 
Forall prow In columnList 
    If printcolumn = prow Then 
     indexresult2 = (Arraygetindex(columnList, prow)) + 1 
     z = (indexresult2*10) + 1 

     For b = 0 To 9 
      setrowfield = "Untitled" & z 
      Set uidoc = ws.CurrentDocument 
      printrowfield = uidoc.FieldGetText(setrowfield) 

      'Redim Preserve rowList(10) 
      rowList(b) = printrowfield 
      z = z + 1  
      'printrow = ws.Prompt(4,"Row List", "", ,rowList)      
     Next  
     printrow = ws.Prompt(4,"Row List", "", ,rowList)  
    End If 

End Forall 

End Sub 

답변

1

columnListPrompt에 대해 고유 한 회원을 가지고있다 : 여기에 내 코드입니다. 이를 달성하는 가장 쉬운 방법은 모든 행 앞에 행 번호를 추가하는 것입니다. 이득으로 당신은 indexresult를위한 선정 된 줄 번호를 아주 쉽게 얻는다.

귀하의 목록은 다음과 같습니다

1. January 1, 1990 
2. January 1, 1990 
3. January 1, 1990 
... 

이는 적응 코드 :

Set uidoc = ws.CurrentDocument 
Redim Preserve columnList(11) 
For a = 0 To 10  
    setfield = "Untitled" & x 
    printfield = uidoc.FieldGetText(setfield) 
    columnList(a) = (a+1) & ". " & printfield 
    x = x + 10   
Next  

printcolumn = ws.Prompt(4,"Column List", "Select:", , columnList)  
indexresult = cint(strLeft(printcolumn, ".")) 
+0

당신은 멋진 사람이야. 고마워요! – drayl