Posted Wed, 11 Sep 2019 16:25:47 GMT by Joe Kaufman Bell Laboratories Inc Application Development Manager
Hey all,

Since I got no response on the other forum, I figured I'd ask a single question more explicitly here.

All of this is on DocuWare 6.11, on-premise.

When using the web client, you can clip documents to an existing document by right-clicking on the document and selecting the "Clip" option (as depicted in the first attached image).

After selecting that option, the Clipping operation is made available via a two-pane screen with the starting document on the top and places to pull in other documents (to clip) on the bottom (e.g. a Document Tray). The second attached image depicts this interface.

So far, so good. You can drag documents to clip in front or behind the starting document, then click the yellow "Clip" button to clip everything together in the order you have assembled. It's really quite nice. The starting document retains all of its indexes, and the clipped document is tacked on back (or front). In my testing, it doesn't even change the Document ID of the starting document. Plus, you can ask to preserve clipped documents in their source tray instead of deleting them.

My question is this: How do I perform this operation via the Platform SDK (API?) Is it possible, or is this functionality only provided via the web client for some reason? Various "Merge" and "Transfer" functions exist in the Platform SDK, but merging involves a single file cabinet GUID. There is no way a function call involving one GUID can take documents from one place and clip them to a document in another place. Transfer functions allow that sort of thing but there is no clip functionality built into that. Additionally, the merge functions are clear to state a new document is created (new ID) and that the documents involved in the merge are deleted from the system. What the web client does is apparently a mix of transferring and merging all in one, and it doesn't change the starting document's ID. It even offers the ability to preserve the documents being clipped.

Can I do this in the Platform SDK API, and if so, what are the functions I should be looking for?

If I can't do it via the Platform SDK, is my only route to place all documents into a document tray, clip them together in the tray, then store the merged document to a file cabinet? I think I can do that now that I have figured out how to upload to a tray via the API, it just seems far less elegant than what the web client offers natively.

Joe Kaufman
Posted Thu, 12 Sep 2019 16:57:24 GMT by Seth Jaco Support Specialist
Are you just wanting to clip documents to other documents through the API? We have done this through 7.0, where we take a CSV file and match up information from documents inside DocuWare, then we would clip the matching documents to the back of a primary document in DocuWare. If we tried clipping to the front it would change the index data and the DWDOCID of the primary document, so we went with clipping to the back. 

Posted Thu, 12 Sep 2019 17:10:13 GMT by Joe Kaufman Bell Laboratories Inc Application Development Manager

Yes. I want to upload a "start" document to a file cabinet, then clip additional documents to the back of that one (they are volumes of a study).

How are you clipping documents to the back of another via the API? The "Merge" operation? Are you clipping documents from one file cabinet to a document in a different file cabinet? Or do you upload the CSV to the same cabinet then merge them?

That is interesting, what you say about the document ID changing if you clip to the front. In my tests, I can clip to the front of back (when using the web client) and the starting document retains its ID no matter what I do. Now, if I split out the separate clipped parts then all documents get a new ID, obviously.

If you have sample code of what you are doing, that would be great. I wanted to avoid having to fully upload the additional files to the cabinet (with indexes) just to clip them and have the indexes not mean anything. That is why I wanted to clip documents in a document tray (no indexing required) to a document stored in a file cabinet. Since the web client can do it, I assumed there must be a cleaner way to do it via the Platform SDK API. If I do end up just needing to upload everything fully into a file cabinet (with indexes) and then merge them there it wouldn't be the end of the world, I don;t suppose.

Posted Thu, 12 Sep 2019 18:05:21 GMT by Seth Jaco Support Specialist
We are using the merge function and clipping documents from within the same file cabinet. You could use trays instead since they use guid's like filecabinets do. Here is the code we are using. 

Posted Thu, 12 Sep 2019 18:39:29 GMT by Josef Zayats
the DWDOCIDs do not get changed, but all clipped documents (clipping more than 2 at once is possible) are 'merged' into the first document retaining its docid and all Index values. (All other original documents get deleted)  If you want documents be clipped in specified order but retain Index Entries from document other than the top one, you'd need to first collect the index values and , after successful Merge, run posting index values to the Merged document.
I also used a technique to collect particular index value from ALL clipped documents and post the list to a keyword field of the merged document.

What I can't get working is stapling instead of clipping - it gives some 'strange'  405 Method Not Allowed (File cabinets do not support StapleAsync error, though I do not use any Async operations, and all my documents are PDFs. - but there is another post on this issue, incidentally authored by Seth.
Posted Thu, 12 Sep 2019 18:53:39 GMT by Joe Kaufman Bell Laboratories Inc Application Development Manager
Seth and Josef,

Thank you! Seth, yes, I have that Merge code working, though not in FoxPro. I may have to write some of these routines in C# instead. I guess I can go ahead and just upload all documents to their final destination, settling on the first one as the "main" document. Then Merge them together once they are all up there. At this point I don't really see why I was so dead set against it, especially if the starting document retains its ID (the documentation says a new document is created, but that must not really be the case, except that of course the document is different once it has stuff clipped to it...

Joe Kaufman

You must be signed in to post in this forum.