Concatenate Documents From Xpath

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples > Concatenate Documents >

Concatenate Documents From Xpath

Overview

This section describes how to use the feature to concatenate documents from an Xpath.

 

Example

In the following sample process, assume we have a process entity called OfficeSupplyRequest.

Such process uses the following data model:

 

ProductRequestDataModel

 

The Quotation Request attribute allows users to upload several files, we want the attribute Request Summary to have all the documents uploaded. To do so we will use the Concatenate documents from Xpath file method.

 

note_pin

The documents to concatenate should be the same format, either PDF or Microsoft Word document. Otherwise, the method will not work correctly.

 

Concatenating Word Documents

In this case the syntax of the function is:

 

CHelper.ConcatDocumentsFromXpathFileToWord(Me, fileXpath)

 

The main parameters of this function are:

The first parameter (Me) is fixed.

The fileXpath: the Xpath to the uploaded documents as a string.

 

To concatenate the files of our example we will need an expression box:

 

concatdoc_xpath_doc

 

The expression above is as follows:

var file = CHelper.ConcatDocumentsFromXpathFileToWord(Me,"OfficeSupplyRequest.QuotationRequest");
var File = Me.newCollectionItem("OfficeSupplyRequest.RequestSummary");
File.setXPath("FileName", "QuotationRequests_" + Me.Case.Id + ".docx");
File.setXPath("Data", file);

 

The resulting file will have as name QuotationRequests_[CaseNumber].docx.

 

note_pin

Please make sure the file extension matches the document type the method uses.

 

Concatenating PDF Documents

In this case the syntax of the function is:

 

CHelper.ConcatDocumentsFromXpathFileToPdf(Me, fileXpath)

 

The main parameters of this function are:

The first parameter (Me) is fixed.

The fileXpath: the Xpath to the uploaded documents as a string.

 

To concatenate the files of our example we will need an expression box:

 

concatdoc_xpath_pdf

 

The expression above is as follows:

var file = CHelper.ConcatDocumentsFromXpathFileToPdf(Me,"OfficeSupplyRequest.QuotationRequest");
var File = Me.newCollectionItem("OfficeSupplyRequest.RequestSummary");
File.setXPath("FileName", "QuotationRequests_" + Me.Case.Id + ".pdf");
File.setXPath("Data", file);

 

The resulting file will have as name QuotationRequests_[CaseNumber].pdf.

 

note_pin

Please make sure the file extension matches the document type the method uses.