Domino Code Fragment

Code Name*
This button script displays the sum of all OrderTotal fields in a database for one day.
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.221.53.209
Description*
Each record in the database has OrderNumber, Date, and OrderTotal fields. The script finds all the documents in the database, then uses a loop and a comparison of dates to limit processing to today's documents. For each document, the script adds the OrderTotal to a dailyTotal variable.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Set db = session.CurrentDatabase
Set dc = db.AllDocuments
dailyTotal = 0
For j = 1 To dc.Count
Set doc = dc.GetNthDocument(j)
odate = doc.Date
dn = Datenumber(Year(odate(0)), _
Month(odate(0)), Day(odate(0)))
orderNumber = doc.OrderNumber
If dn = Today _
And orderNumber(0) <> "DAILY TOTAL" Then
orderTotal = doc.OrderTotal
dailyTotal = dailyTotal + orderTotal(0)
End If
Next
Messagebox Format(dailyTotal, "Currency")
End Sub