Lotus Notes 7-复制/移动文档.(父级和响应文档),而无需更改UNID? [英] Lotus Notes 7 - copy / move docs. ( parent & response docs ) without changing the UNID ?
问题描述
我有2个数据库:假设dbA和dbB.实际上,dbB是dbA的子"数据库,因为它所包含的表单/视图/框架集/等也都在dbA中.
I have 2 databases : let say dbA and dbB. Actually, dbB is a ''child'' database of dbA, because the forms/views/frameset/etc that it contains they all are also in dbA.
我现在要从dbA的一个视图(比如说vwA)中复制一些8K文档到dbB的同一个视图(vwA).这些8k包含父文档和子文档,在dbA中用@Text(@UniqueDocumentID)列出了OK.我刚刚进行了测试,复制了一个父文档及其响应,然后粘贴到第二个数据库中,但是不幸的是,这两个文档之间的连接并未建立.我猜UNID已经更改了……
I want now, to copy from a view ( let say vwA ) from dbA some 8K docs to the same view ( vwA ) from dbB. THese 8k contains both parent and child docs, which in dbA are listing OK, with @Text(@UniqueDocumentID). I just made a test, copy one parent doc and its response, and pasted in the 2nd database, but unfortunately the connection between the 2 docs isn't made... I guess the UNID had changed...
有什么解决办法吗?谢谢您的宝贵时间.
Is there any solutions? Thanks for your time.
推荐答案
是的,将文档复制到另一个数据库始终会为目标数据库中的文档创建一个新的UniversalID.
Yes, copying a document to another database always creates a new UniversalIDs for document in target database.
为避免这种情况,您的LotusScript应该像这样工作:
To avoid this, your LotusScript should work like this:
- 在目标数据库中创建新文档 从源文档到目标文档的
-
CopyAllItems
- 将相同的UniversalID设置为目标文档
targetDoc.UniversalID = sourceDoc.UniversalID
- 保存目标文档
- create new document in target database
CopyAllItems
from source document to target document- set same UniversalID to target document
targetDoc.UniversalID = sourceDoc.UniversalID
- save the target document
这样,目标文档与源文档具有相同的UniversalID,并且文档之间的链接也应在目标数据库中起作用.
This way the target document has the same UniversalID like the source document and links between document should work in target database too.
这是代理处理选定文档的示例:
This is an example for an agent working on selected documents:
Dim session As New NotesSession
Dim dbSource As NotesDatabase
Dim dbTarget As NotesDatabase
Dim col As NotesDocumentCollection
Dim docSource As NotesDocument
Dim docTarget As NotesDocument
Set dbSource = session.Currentdatabase
Set dbTarget = session.Getdatabase(dbSource.Server, "YourTargetDatabase.nsf", false)
Set col = dbSource.Unprocesseddocuments
Set docSource = col.Getfirstdocument()
While Not docSource Is Nothing
Set docTarget = dbTarget.Createdocument()
Call docSource.Copyallitems(docTarget, true)
docTarget.UniversalID = docSource.UniversalID
Call docTarget.save(True, False)
Set docSource = col.Getnextdocument(docSource)
Wend
这篇关于Lotus Notes 7-复制/移动文档.(父级和响应文档),而无需更改UNID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!