gpt4 book ai didi

lotus-notes - 我需要 View 中两列的总和

转载 作者:行者123 更新时间:2023-12-04 07:09:50 26 4
gpt4 key购买 nike

我发现这段代码通过并打印出两列的csv。我后来解析并计算了两列。我想在这里计算它而不是稍后打印和计算。我一直在胡思乱想,但无法弄清楚。

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

提前感谢您的任何帮助。

最佳答案

试试这个,它通过将 colval 字符串转换为数值来将列累积到 rowval 中。如果它们是浮点数,您可以轻松地使用 double/CDbl() 。这是假设,通过“计算两列”,您的意思是将它们相加并输出总和。如果您的意思是字面上的计数,请将其保留为 Integer并改变线

rowval = rowval + CInt(colval)


rowval = rowval + 1

这里是:
Dim entry As NotesViewEntry
Dim vc As NotesViewEntryCollection
Dim rowval As Integer ' or 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() '
End Forall
' Output rowval here. '
Set entry=vc.GetNextEntry (entry)
Wend

根据您的原始示例,我没有输出任何内容(?),但我已经在您应该做的地方发表了评论。

关于lotus-notes - 我需要 View 中两列的总和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/555277/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com