Skip to content

Instantly share code, notes, and snippets.

@joacim-boive
Last active August 29, 2015 13:59
Show Gist options
  • Save joacim-boive/10656980 to your computer and use it in GitHub Desktop.
Save joacim-boive/10656980 to your computer and use it in GitHub Desktop.
Slow looping LotusScript - Just a normal looping construct. But, there's a better way!
Option Public
Option Declare
Use "helpers"
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim vRequest As NotesView
Dim vMatchVacancy As NotesView
Dim vcRequest As NotesViewEntryCollection
Dim vcMatchVacancy As NotesViewEntryCollection
Dim veRequest As NotesViewEntry
Dim veMatchVacancy As NotesViewEntry
Dim rowIds As String
Dim key As String
Dim count As integer
Print "content-type: text;charset=utf-8;"
On Error GoTo handler
Set db = s.Currentdatabase
Set vRequest = db.getView("vRequest-list")
Set vMatchVacancy = db.getView("vMatchVacancy")
Call vRequest.refresh()
Call vMatchVacancy.refresh()
Set vcMatchVacancy = vMatchVacancy.Allentries
Set veMatchVacancy = vcMatchVacancy.Getfirstentry()
While Not veMatchVacancy Is Nothing
key = veMatchVacancy.Columnvalues(0)
Set veRequest = vRequest.Getentrybykey(key, true)
If(veRequest Is Nothing) Then
rowIds = rowIds & veMatchVacancy.Columnvalues(1) & ","
End If
Set veMatchVacancy = vcMatchVacancy.Getnextentry(veMatchVacancy)
Wend
Print rowIds
exitSub:
Exit Sub
handler:
MsgBox db.filepath & "agentMatchVacancys - " & Error & Chr(13) + "Module: " & CStr( GetThreadInfo(1) ) & ", Line: " & CStr( Erl )
Print Error & Chr(13) + "Module: " & CStr( GetThreadInfo(1) ) & ", Line: " & CStr( Erl )
Resume exitSub
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment