Merging documents

Merging documents

Postby ddavydov » Wed Dec 10, 2014 10:32 am

We are developing a workflow agent that merges together documents that belongs to same client. The main document contains initial data, and variable amount of additional documents that hold more data if it exists. We create loose pages from additional documents, and add them to the main document based on client id.

For Each oDocumentElement In oDocumentCollection
Dim srOtherMemNum As String
Dim srMmainMemNum As String

If oDocumentElement.AttributeValue("FormTypeName").Trim = "MainForm" Then
srMmainMemNum = getFieldValue(oDocumentElement, "ClientID")
oMainDocument = oDocumentElement
Else
Dim i As Integer
srOtherMemNum = getFieldValue(oDocumentElement, "ClientID")
If srOtherMemNum = srMmainMemNum Then
oPagesElement = oDocumentElement.FindChildElementByName _
("Pages")
oPagessCollection = oPagesElement.FindChildElementsByName("Page")
For i = 1 To oPagessCollection.Count
aNewPage = oBatchPages.CreatePageChildElement(oPagessCollection.Item(i).AttributeValue("ImageFile"))
newDocumentPages = oMainDocument.FindChildElementByName("Pages")
aNewPage.MoveToBack(newDocumentPages)
oOtherDocument = oDocumentElement
oPagessCollection.Item(i).Delete()
Next
oDocumentElement.Delete()
End If
End If

Next


It works well but only if documents are grouped together by client id for scan. But we can’t the same result when the batch prepped randomly. Can anyone give me an idea about the way to add document’s pages to main document when they appear randomly in the batch?[/i][/i]
ddavydov
Participant
 
Posts: 51
Joined: Thu Jul 19, 2012 12:06 pm

Re: Merging documents

Postby ddavydov » Thu Dec 11, 2014 8:24 am

Thanks everyone.
I resolved the issue.
ddavydov
Participant
 
Posts: 51
Joined: Thu Jul 19, 2012 12:06 pm


Return to Custom Modules General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests