现在需要把主表单的一些域,添加到行明细里。
两个视图:1:主表单视图
2:行项目视图
取主表单视图:根据每个主表单的KEYUNID去行项目视图里找出对应的行名细文档,
进行增加域的操作;就是不能更新成功,麻烦哪位大神看看下面代码,哪里有问题,谢谢!
Dim session As NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim vc As NotesDocumentCollection
Dim view1 As NotesView
Dim doc As NotesDocument
Set F = New f_default
Set session = New NotesSession
Set db = session.CurrentDatabase
Set view1=db.Getview("v_all_zhu")
Set view=db.getview("v_hangmingxi")'主表单视图
'循环取视图中的主表单
Set doc =view1.Getfirstdocument()
While Not (doc Is Nothing )
Set vc = view.Getalldocumentsbykey(doc.Getitemvalue("KEYUNID"), True)
MsgBox doc.Getfirstitem("REQUESTNUMBER").Text
For i=1 To vc.Count
Call vc.Getnthdocument(i).Appenditemvalue("REQUESTNUMBER",doc.Getitemvalue("REQUESTNUMBER"))
Call vc.Getnthdocument(i).Appenditemvalue("creater_show",doc.Getitemvalue("creater_show"))
Call vc.Getnthdocument(i).Appenditemvalue("EmployeeDept",doc.Getitemvalue("EmployeeDept"))
Call vc.Getnthdocument(i).Appenditemvalue("System",doc.Getitemvalue("System"))
Call vc.Getnthdocument(i).Appenditemvalue("BGType",doc.Getitemvalue("BGType"))
Call vc.Getnthdocument(i).Appenditemvalue("Other",doc.Getitemvalue("Other"))
Call vc.Getnthdocument(i).Appenditemvalue("HuiQianUser_Show",doc.Getitemvalue("HuiQianUser_Show")) Call vc.Getnthdocument(i).Appenditemvalue("Status",doc.Getitemvalue("Status"))
Call vc.Getnthdocument(i).Appenditemvalue("CreateTime", doc.Getitemvalue("CreateTime"))
Call vc.Getnthdocument(i).Save(True,True) Next
Set doc = view1.Getnextdocument(doc)
Wend
End Sub