Lotus Notes: Finding the sum of two columns

351865 pts.
Tags:
Lotus Notes
I currently have this code that goes through and prints out CSV for both columns. After it's printed, I count the two columns manually. Is there a way I can do that automatically and the print it? Here's what I have so far:
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim rowstring As String
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim view As NotesView
Set view = db.GetView( nameofview )
Set vc = view.AllEntries
Set entry = vc.GetFirstEntry()

While Not entry Is Nothing 
	rowstring = ""
	Forall colval In entry.ColumnValues
		If rowstring = "" Then
			rowstring = colval
		Else
			rowstring = rowstring + +","  + colval
		End If			
	End Forall
Wend
Thanks for the help in advance.

Answer Wiki

Thanks. We'll let you know when a new response is added.
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim rowval As Integer                       ' data type as you wish single/ long /double
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim view As NotesView
Set view = db.GetView( nameofview )
Set vc = view.AllEntries
Set entry = vc.GetFirstEntry()

While Not entry Is Nothing 
    rowval = 0
    Forall colval In entry.ColumnValues
        rowval = rowval + CInt(colval)      ' Or CDbl instead of CInt, Csng,CLng etc
    End Forall
    ' Output rowval here. '
    Set entry=vc.GetNextEntry (entry)
Wend

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Stiletto

    I'm not sure what you want.  Do you want a third column that is the sum of the first 2 columns?  Do you want a final tally at the bottom that is the grand total of column 1 and column 2?

    4,050 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following