I have a form that takes in two date values from the user. They click on a button that calls a lotusscript agent. Here is the code I have so far below:
Sub Initialize
Dim counter As Integer
Dim allDates As Variant
Dim concatResults As String
Dim dc As notesdocumentcollection
Dim lookupView As NotesView
Dim currDoc As NotesDocument
Set session = New NotesSession
Set db = session.CurrentDatabase
Set lookupView = db.GetView( "ABCD" )
counter = 0
Set doc = session.DocumentContext
If doc.FieldToSearch(0) = "Completed Date" Then
Set lookupView = db.GetView( "ABCD" )
Else
Set lookupView = db.GetView( "ABSD" )
End If
allDates = doc.GetItemValue("DatesExploded")
Forall v In allDates
Set dc = lookupView.GetAllDocumentsByKey(v,True)
If Not dc.Count = 0 Then
Set doc = dc.GetFirstDocument
While Not doc Is Nothing
counter = counter + 1
If doc.FieldToSearch(0) = "Completed Date" Then
Set dTime = New NotesDateTime(Cstr(doc.CompletedDate(0)) )
concatResults = Cstr(dTime.DateOnly) & Chr(9) & Chr(9) & Cstr(doc.RequestNum(0)) & Chr(9) & Chr(9) & Cstr(doc.NameOfService(0))
Else
Set dTime = New NotesDateTime(Cstr(doc.ScheduledDate(0)) )
concatResults = Cstr(dTime.DateOnly) & Chr(9) & Chr(9) & Cstr(doc.RequestNum(0)) & Chr(9) & Chr(9) & Cstr(doc.NameOfService(0))
End If
Print "3"
Print concatResults "<br>"
'doc.dResults = currdoc.dResults + ";" + concatResults
Set doc = dc.GetNextDocument(doc)
Print "4"
Wend
End If
End Forall
Print "5"
If counter = 0 Then
Print |<SCRIPT language="JavaScript">alert("No results were found for your search criteria.")</SCRIPT>
|
End If
End Sub
As of now I print the results on a blank web page that automatically comes up after the button is clicked. I have a line of code commented out that is supposed to take the results and place it in a field on a form, but since it moves from the original form to a new page, I can’t use that field.
Does anybody have any ideas on how to display results? I’d like to display them in the same form, but if I have to display it opening up a new page, I’d like to do that with my database banner and CSS as well. Any thoughts?