mardi 2 février 2016

Not able to get out of the loop after getfirstitem in lotus script

Sub Initialize

On Error GoTo ErrorOut  

Dim sess As NotesSession
Dim db As NotesDatabase
Dim doc, searchDoc, reqNumDoc As NotesDocument
Dim body As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim stream As NotesStream
Dim vwSearchRequests As NotesView
Dim reqNum, totalNotify, totalAccepted, totalRejected, totalOOO, totalNoRes As Integer
Dim reqSer, reqJRSS, reqSPOC, reqNumStr As String
Dim reqDate As String
Dim reqNumColl As NotesDocumentCollection
Dim reqPanelRes As NotesItem
Dim reqPanelResValue As Variant

Set sess = New NotesSession
Set db = sess.CurrentDatabase
Set vwSearchRequests = db.GetView("RequestDocReport")
vwSearchRequests.Autoupdate = False
Set searchDoc = vwSearchRequests.GetFirstDocument

While Not searchDoc Is Nothing
    reqSer = "Service"
    reqJRSS = searchDoc.PS_JRSS(0)
    reqSPOC = "Hiring SPOC"
    totalAccepted = 0
    totalRejected = 0
    totalOOO = 0
    totalNoRes = 0
    totalNotify = 0

    reqNum = searchDoc.PS_RequestNo(0)
    reqNumStr = {PS_RequestNo = "} & reqNum & {"}
    Set reqNumColl = vwSearchRequests.GetAllDocumentsByKey(reqNumStr)
    Set reqNumDoc = reqNumColl.GetFirstDocument
    While Not reqNumColl Is Nothing

        If Not reqNumDoc.GetFirstItem("PanelResponse") Is Nothing Then
            reqPanelResValue = reqNumDoc.GetItemValue("PanelResponse") 
            MsgBox CStr(reqPanelResValue(0))
            'Exit Sub
            If CStr(reqPanelResValue(0)) = "Accepted" Then
                totalAccepted = totalAccepted + 1
            End If
            If CStr(reqPanelResValue(0)) = "Rejected" Then
                totalRejected = totalRejected + 1
            End If
            If CStr(reqPanelResValue(0)) = "OOO" Then
                totalOOO = totalOOO + 1
            End If  
        Else
            If CStr(reqPanelResValue(0)) = "" Then
                totalNoRes = totalNoRes + 1
            End If
        End If

        totalNotify = totalNotify + 1
        Set reqNumDoc = reqNumColl.GetNextDocument(reqNumDoc)
    Wend

what is the error in code? The code is getting stuck after If Not reqNumDoc.GetFirstItem("PanelResponse") Is Nothing Then reqPanelResValue = reqNumDoc.GetItemValue("PanelResponse") ...Plz help

Aucun commentaire:

Enregistrer un commentaire