• Urgent !! Database does not fetch values from the view

    By Roopa B Bangaru 2 decades ago

    Sub Click(Source As Button)

    Dim curdb As NotesDatabase <br/>
    Dim session As New NotesSession <br/>
    Dim firstview As NotesView <br/>
    Dim viewdoc As NotesDocument<br/>
    Dim firstviewcollection As NotesViewEntryCollection<br/>
    <br/>
    <br/>
    Set curdb =session.Currentdatabase<br/>
    Set firstview =curdb.GetView(&quot;AddForm&quot;)<br/>
    Set firstviewcollection=firstview.AllEntries<br/>
    Dim Fentry As NotesViewEntry<br/>
    Set Fentry=firstviewcollection.GetFirstEntry<br/>
    <br/>
    While Not Fentry Is Nothing<br/>
        Set viewdoc=Fentry.Document<br/>
        Msgbox viewdoc.uname(0)<br/>
        <br/>
        Dim nextdb As NotesDatabase <br/>
        Dim nextsession As New NotesSession <br/>
        Dim secondview As NotesView <br/>
        <br/>
        <br/>
        Set nextdb=nextsession.GetDatabase(&quot;&quot;,&quot;names.nsf&quot;)<br/>
        If Not  nextdb Is Nothing Then<br/>
            Msgbox &quot;A&quot;<br/>
        End If<br/>
        Set secondview =nextdb.GetView(&quot;($Users)&quot;)<br/>
        If   Not secondview Is Nothing Then<br/>
            Msgbox &quot;B&quot;<br/>
        End If<br/>
        Dim secondoc As NotesDocument<br/>
        Msgbox &quot;Secondloop&quot;<br/>
        'Set notesDocument = notesView.GetDocumentByKey( keyArray [, exactMatch% ] )<br/>
        Set secondoc=seconddoc.GetDocumentByKey(viewdoc.uname(0),True)<br/>
        Msgbox secondoc.shortname(0)<br/>
        Set Fentry=firstviewcollection.GetNextEntry(Fentry)<br/>
        <br/>
    Wend<br/>
    <br/>
    

    End Sub







    The Loop Iterates for the first time and next time it tries to fetch the short name from names.nsf database it does not .. the code is not working from this part



    Set secondoc=seconddoc.GetDocumentByKey(viewdoc.uname(0),True)

        Msgbox secondoc.shortname(0)<br/>
        Set Fentry=firstviewcollection.GetNextEntry(Fentry)<br/>
    



    Thanks for help

    Roopa