Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Initialize
- Dim session As New NotesSession
- Dim db As NotesDatabase
- Dim doc As NotesDocument ' agent context
- Dim View As NotesView ' search view
- Dim vEntries As NotesViewEntryCollection
- Dim vEntry As NotesViewEntry
- Dim strCol1 As String
- Dim strCol2 As String
- Dim strCol3 As String
- Dim strCol4 As String
- Dim json As String
- Set db = session.currentdatabase
- Set doc = session.DocumentContext
- On Error Goto ErrorHandler
- ' use to force agent output to not include header info
- Print "Content-type: application/json"
- Set view=db.GetView("events1")
- Set vEntries=view.Getallentriesbykey("A",True)
- If vEntries.Count = 0 Then ' NO DOCS FOUND ERROR
- ' json = {toplevel:[{"Status":"No Documents Found"}]}
- Print json
- Goto TheEnd
- End If
- json = "["
- Set vEntry = vEntries.GetFirstEntry
- Dim i As Integer
- While Not(vEntry Is Nothing)
- strCol1= vEntry.Columnvalues(0)
- strCol2 = vEntry.Columnvalues(1)
- strCol3 = vEntry.Columnvalues(2)
- strCol4 = vEntry.Columnvalues(3)
- Set vEntry = vEntries.Getnextentry(vEntry)
- If vEntry Is Nothing Then
- ' json = json + {"title":}+ strcol + "{}}]}
- Else 'need the , at the end if not the last entry
- ' json = json +"{""allday"":false,""title"":""+ strcol3+ "','start':"'+ strcol1+ "','end':'"+ strcol2+ "','id':'"+strCol4+"' },"
- If strcol2="" Then
- json = json +"{""allday"":false,""title"":""" + strcol3+ """,""start"":"""+ strcol1+ """ },"
- Else
- json = json +"{""allday"":false,""title"":""" + strcol3+ """,""start"":"""+ strcol1+ """,""end"":"""+ strcol2+ """ },"
- End If
- i=i+1
- End If
- Wend
- json = Left(json,Len(json)-1) + "]"
- 'Messagebox json
- Print json
- Goto TheEnd
- Exit Sub
- ErrorHandler:
- ' json = {toplevel:[{"ERROR":Error$ & " Line#: " & Erl & Object: & Lsi_info(2)}]}
- Print json
- Resume TheEnd
- TheEnd:
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement