• AMgr: Agent ('WebBoardIndexSchedule' in 'Database\WSC Alleman\Jeugdwer.nsf') error message: Object variable not set

    By Tommy Peeters 2 decades ago

    UPDATE: 01feb09 Installed Designer 7 on a virtual machine and I was able to run the agent manually. When I run the agent in LN8.5 then the following error pop's up.



    Hello all,

    For one reason or another the WebBoardIndexSchedule is not running smoothly. Agent gives the following error in the log: object variable not set.



    31/01/2009 20:07:34 AMgr: Agent ('WebBoardIndexSchedule' in 'Database\WSC Alleman\Jeugdwer.nsf') error message: Object variable not set





    Started running agent 'WebBoardIndexSchedule' on 31/01/2009 20:06:34

    Running on all documents in database: 39 total

    Found 39 document(s) that match search criteria

    Ran LotusScript code

    Done running agent 'WebBoardIndexSchedule' on 31/01/2009 20:06:36



    Accoding to the LNscript debugger the problem lies here:

            Set tmpdoc = entry.Document<br/>
    



    I do not uderstand this, I've checked the full code and did not find discrepancies and I did not make any modification to the code.



    Pls find here the full code:



    Sub Initialize

    <br/>
    ' This agent update the webboard index pages with document counts, last posts etc...<br/>
    ' Must be scheduled every x min on server (recommended value is 15 min)<br/>
    <br/>
    Dim s As New NotesSession<br/>
    Dim view As NotesView<br/>
    Dim viewcategories As NotesView<br/>
    <br/>
    Set db = s.CurrentDatabase<br/>
    <br/>
    Set viewcategories=db.GetView(&quot;(LookupCategories)&quot;)<br/>
    viewcategories.AutoUpdate=False<br/>
    Set view = db.GetView(&quot;WebBoardIndex&quot;)<br/>
    view.AutoUpdate=False<br/>
    <br/>
    'first we loop thru all cat to see if some are now empty<br/>
    Set doccategory=viewcategories.GetFirstDocument<br/>
    Do Until doccategory Is Nothing<br/>
        Set doc=view.GetDocumentByKey(doccategory.getItemValue(&quot;Category1&quot;))<br/>
        If doc Is Nothing Then<br/>
            Call doccategory.ReplaceItemValue(&quot;MainCount&quot;,&quot;0&quot;)<br/>
            Call doccategory.ReplaceItemValue(&quot;RespCount&quot;,&quot;0&quot;)<br/>
            Call doccategory.ReplaceItemValue(&quot;LastSubject&quot;,&quot;&quot;)<br/>
            Call doccategory.ReplaceItemValue(&quot;LastResponseDateServer&quot;,&quot;0&quot;)<br/>
            Call doccategory.Save(False,False)<br/>
        End If<br/>
        Set doccategory=viewcategories.GetNextDocument(doccategory)<br/>
    Loop<br/>
    <br/>
    'next we update counters for each categories<br/>
    Set nav = view.CreateViewNav<br/>
    Set entry = nav.GetFirst<br/>
    <br/>
    Do Until entry Is Nothing Or entry.IsCategory=False<br/>
        <br/>
        Set doccategory = viewcategories.GetDocumentByKey( Cstr(entry.ColumnValues(0)) , True)<br/>
        If Not (doccategory Is Nothing) Then<br/>
            Call doccategory.ReplaceItemValue(&quot;MainCount&quot;,Cstr(entry.ColumnValues(2)))<br/>
            Call doccategory.ReplaceItemValue(&quot;RespCount&quot;,Cstr(entry.ColumnValues(3)))<br/>
            Set entry =  nav.GetNextDocument( entry )   <br/>
            Set tmpdoc = entry.Document<br/>
            tmp=&quot;&lt;script&gt;_wi2('&quot;+ Cstr(tmpdoc.CreatedServer(0))+&quot;','&quot;+ HTMLEncode(Left$(tmpdoc.Subject(0),28) &amp; &quot; ...&quot; )+&quot;','&quot;+_ <br/>
            HTMLEncode(tmpdoc.Pseudo(0))+&quot;','&quot;+tmpdoc.UniversalID+&quot;','&quot;+    tmpdoc.MainUNID(0)+&quot;','&quot;+&quot;')&lt;/script&gt;&quot;<br/>
            Call doccategory.ReplaceItemValue(&quot;LastSubject&quot;,tmp)<br/>
            Call doccategory.ReplaceItemValue(&quot;LastResponseDateServer&quot;,Cstr(tmpdoc.CreatedServer(0)))<br/>
            Call doccategory.Save(False,False)<br/>
        Else<br/>
            Set doccategory = db.CreateDocument<br/>
            doccategory.Form=&quot;Category&quot;<br/>
            doccategory.Category1=Cstr(entry.ColumnValues(0))<br/>
            Call doccategory.Save(False, False)<br/>
        End If<br/>
        <br/>
        Set entry =  nav.GetNextCategory( entry )   <br/>
        <br/>
    Loop<br/>
    <br/>
    

    End Sub



    Anu clue?

    Thanks in advance!

    T.

    • Same problem here

      By Michael Mazzotta 1 decade ago

      I looked at the code and here is where it fails.

      Set nav = view.CreateViewNav<br/>
      Set entry = nav.GetFirst<br/>
      

      ….

      Set entry =  nav.GetNextDocument( entry )   ' Fails here<br/>
      



      I added "Dim entry As NotesViewEntry" but that did not help.



      The entry is at the top category in WebBoardIndex. There is no document associated to it so the GetNextDocument returns nothing. You don't want to input a GetFirst document since that will just get to the first one in the view. I believe the agent wants to step down each category and pull the first document under each category. This is not working in 8.5.



      I'm still searching for a solution….



      UPDATE:

      It looks like it is a confirmed bug with 8.5 and NotesViewNavigator

      http://www-10.lotus.com/ldd/nd85forum.nsf/Customer/ebca45e80b902efa85257568004096f5?OpenDocument

      • Fix for WebBoardIndexSchedule running on 8.5

        By Michael Mazzotta 1 decade ago

        I modified the code to use CreateViewNavFromCategory to limit the lookup to the first document in the View category.



        Sub Initialize

        <br/>
        ' This agent update the webboard index pages with document counts, last posts etc...<br/>
        ' Must be scheduled every x min on server (recommended value is 15 min)<br/>
        <br/>
        Dim s As New NotesSession<br/>
        Dim view As NotesView<br/>
        Dim viewcategories As NotesView<br/>
        Dim entry As NotesViewEntry<br/>
        Dim nav As NotesViewNavigator<br/>
        Dim entrySub As NotesViewEntry<br/>
        Dim navSub As NotesViewNavigator<br/>
        <br/>
        Set db = s.CurrentDatabase<br/>
        <br/>
        Set viewcategories=db.GetView(&quot;(LookupCategories)&quot;)<br/>
        viewcategories.AutoUpdate=False<br/>
        Set view = db.GetView(&quot;WebBoardIndex&quot;)<br/>
        view.AutoUpdate=False<br/>
        <br/>
        'first we loop thru all cat to see if some are now empty<br/>
        Set doccategory=viewcategories.GetFirstDocument<br/>
        Do Until doccategory Is Nothing<br/>
            Set doc=view.GetDocumentByKey(doccategory.getItemValue(&quot;Category1&quot;))<br/>
            If doc Is Nothing Then<br/>
                Call doccategory.ReplaceItemValue(&quot;MainCount&quot;,&quot;0&quot;)<br/>
                Call doccategory.ReplaceItemValue(&quot;RespCount&quot;,&quot;0&quot;)<br/>
                Call doccategory.ReplaceItemValue(&quot;LastSubject&quot;,&quot;&quot;)<br/>
                Call doccategory.ReplaceItemValue(&quot;LastResponseDateServer&quot;,&quot;0&quot;)<br/>
                Call doccategory.Save(False,False)<br/>
            End If<br/>
            Set doccategory=viewcategories.GetNextDocument(doccategory)<br/>
        Loop<br/>
        <br/>
        'next we update counters for each categories<br/>
        Set nav = view.CreateViewNav<br/>
        Set entry = nav.GetFirst<br/>
        <br/>
        Do Until entry Is Nothing Or entry.IsCategory=False<br/>
            <br/>
            Set doccategory = viewcategories.GetDocumentByKey( Cstr(entry.ColumnValues(0)) , True)<br/>
            If Not (doccategory Is Nothing) Then<br/>
                Call doccategory.ReplaceItemValue(&quot;MainCount&quot;,Cstr(entry.ColumnValues(2)))<br/>
                Call doccategory.ReplaceItemValue(&quot;RespCount&quot;,Cstr(entry.ColumnValues(3)))<br/>
                Set navSub = view.CreateViewNavFromCategory (Cstr(entry.ColumnValues(0)))<br/>
                Set entrySub =  navSub.GetFirstDocument<br/>
                Set tmpdoc = entrySub.Document<br/>
                tmp=&quot;&lt;script&gt;_wi2('&quot;+ Cstr(tmpdoc.CreatedServer(0))+&quot;','&quot;+ HTMLEncode(Left$(tmpdoc.Subject(0),28) &amp; &quot; ...&quot; )+&quot;','&quot;+_ <br/>
                HTMLEncode(tmpdoc.Pseudo(0))+&quot;','&quot;+tmpdoc.UniversalID+&quot;','&quot;+    tmpdoc.MainUNID(0)+&quot;','&quot;+&quot;')&lt;/script&gt;&quot;<br/>
                Call doccategory.ReplaceItemValue(&quot;LastSubject&quot;,tmp)<br/>
                Call doccategory.ReplaceItemValue(&quot;LastResponseDateServer&quot;,Cstr(tmpdoc.CreatedServer(0)))<br/>
                Call doccategory.Save(False,False)<br/>
            Else<br/>
                Set doccategory = db.CreateDocument<br/>
                doccategory.Form=&quot;Category&quot;<br/>
                doccategory.Category1=Cstr(entry.ColumnValues(0))<br/>
                Call doccategory.Save(False, False)<br/>
            End If<br/>
            <br/>
            Set entry =  nav.GetNextCategory( entry )   <br/>
            <br/>
        Loop<br/>
        <br/>
        

        End Sub