Hello,
I am new to Lotus Notes and have been assigned to Web Enable and existing Lotus Notes Application (RL6). One of the pages has Lotus Script code that is triggered on the “onchange” event of a date/time field. The user enters a “From” and “TO” date. When the “To” date is entered the script searches all documents in the range using db.search and then certain fields are set after checking some of the fields in the returned documents.
MY question is how to make this work the same way from the web using javascript? or perhaps “common javascript” so that the same script can suffice for both notes and the web.
I am reproducing The Lotus code below to give a better idea of what i am doing.
ps.If possible where can i find a good resource of using javascript in notes?(that explains database access and manipulation)
Sub Onchange(Source As Field)
'Declare object reference
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim doc1 As NotesDocument
Dim item As NotesItem
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
'Declare scalar variable
Dim cFormula As String
Dim cFrmDate As String
Dim cToDate As String
Dim cStatus As String
Dim nTotQuot As Integer
Dim nAwarded As Integer
Dim nInProgress As Integer
Dim nCompleted As Integer
Set uidoc = workspace.CurrentDocument
Set doc=uidoc.Document
Set item=doc.GetFirstItem(“FrmDate”)
cFrmDate = item.values(0)
Set item=doc.GetFirstItem(“ToDate”)
cToDate = item.values(0)
cFormula = “SELECT Form = ““QuotMnt””” & " & QuotRefDt >= [" & Cdat(cFrmDate) & “] & QuotRefDt <= [” & Cdat(cToDate) & “]”
Set db = session.CurrentDatabase
Set collection = db.Search(cFormula,Nothing,0)
Set doc1=collection.GetFirstDocument
nTotQuot = 0
nAwarded = 0
nInProgress = 0
nCompleted = 0
Do Until doc1 Is Nothing
nTotQuot = nTotQuot + 1
Set item=doc1.GetFirstItem(“QuotJobStatus”)
cStatus = item.values(0)
If ( cStatus <> “Rejected” And cStatus <> “Open” )Then
nAwarded = nAwarded + 1
End If
If cStatus = “InProgress” Then
nInProgress = nInProgress + 1
End If
If cStatus = “Completed” Then
nCompleted = nCompleted + 1
End If
Set doc1 = collection.GetNextDocument(doc1)
Loop
If nTotQuot <> 0 Then
doc.StrikeTotQuot= nTotQuot
doc.StrikeAwarded= nAwarded
doc.StrikeInProgress= nInProgress
doc.StrikeCompleted= nCompleted
doc.StrikeStrikeRate= Round((nAwarded/nTotQuot)*100),2)
End If
End Sub