Concatenate Documents From XPath

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Process wizard > Business Rules > Business Rules examples > Documents and files > File management with expressions > 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.


Last Updated 1/6/2022 4:16:39 PM