Appending Word Documents

Last Updated: 07/19/2016 Introduced in Verision: 2.0

This tutorial demonstrates how to Append Word Documents using Append Word Doc To Word Doc and Combine Multiple Word Documents steps. These steps can be found in Data > Documents category in the ToolBox.

 

Example:

We begin in the Designer Folder with clicking Create Flow option from Folder Actions panel.

 createFlow

Next, we Name the Flow and click Create to proceed to the Flow Designer.

 nameFlow

In the Flow Designer we are going to create a Data Definition that will hold all our Word Documents. We add Create or Copy Data step from All Steps [Catalog] > Data category in the Flow Designer Wizard.

 addCreateOrCopyData

In the resulting Data Definitions window we click Add New.

 addNewDataDefinition

Next, in Add DataDefinitions window we name our Data, define its Type FileData, and check Is List checkbox. Then, click Ok to save and close this window.

 dataDefinition

In the Data Definitions window we click Add to continue…

 dataDefined

Then, we are going to configure Data for this Create or Copy Data step. We select it on the workspace and choose Show Mapping Editor from Step Options Menu.

 showMappingForCreateOrCopy

In the Mapping Editor we select Build Array Mapping type for the WordDocuments Data Definition.

 buildArrayForCreate

For the Items in the Array we select Constant Mapping type and using Value picker add desirable Documents. To add another Item to the Array we use Add Item option.

 addItemToArray

After we have added all Documents to the Array, we change the outcome type to Array – Items.

 returnArrayOfItems

We define number of Items we want to output. Then, we Name each Data Item as following… When finished, we click Ok to save and close Mapping Editor.

mappingForCreateComplete

Our Word Documents for this Example look as following…

WordDocOne:

 wordDocOne

WordDocTwo:

 wordDocTwo

WordDocThree:

 wordDocThree

Back in the Flow Designer we add Append Word Doc To Word Doc step from All Steps [Catalog] > Data Documents category in the Flow Designer Wizard. With this step we can Append only two Word Documents.

 addAppendWord

Then, we call Mapping Editor for this step…

 showMappingForAppend

In the Mapping Editor we connect WordDocOne to documentFileToAppend field and WordDocTwo to documentBeingAdded field. Then, save and close Mapping Editor.

 mappingForAppend

Next, we add to our Flow Combine Multiple Word Documents step from All Steps [Catalog] > Data > Documents category in the Flow Designer Wizard. With this step we can add an Array of Documents to the Word Document.

 addCombineDocs

Then, we Show Mapping Editor for this step…

 showMappingForCombineDocs

In the Mapping Editor we connect WordDocOne to the documentFileToAppend field. Then we choose Build Array Mapping type for the documentsBeingAdded field.

 buildArrayForCombineDocs

We connect WordDocTwo and WordDocThree as Items for the Array. Then, we click Ok to save and close Mapping Editor.

 mappingForCombineDocs

Back in the Flow Designer we are going to add Download File Form from the Flows, Rules, Forms and Reports > Forms [Interaction] > [Current Folder] category.

 addForm

This Form was designed for this tutorial. It has one Button control from Actions category and two File Download controls from File Handling category.

 formDesign

We select Show Mapping Editor option for the Download File Form step…

 showMappingForForm

In the Mapping Editor we are going to use Build Data Mapping type for both File Download controls…

 buildDataMappingType

Data Mapping should look as following. Note, that we need to include a file extension in the FileName field. When finished, we save and close Mapping Editor.

 mappingForFormCompleted

This completes our Flow. We click Debug Flow link on the top panel in the Flow Designer to test our Flow.

Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access the Debugger.

3.5 Test Flow Shot

 debugFlow

Download File Form opens in the Debugger… We click first File Download control on the Form and follow the instructions to save the file that was generated in the Append Word Doc To Word Doc step.

 downloadFirstFile

Then, we click second File Download control to save Combined Multiple Word Documents file…

 downloadSecondFile

Decisions informs us that the File was saved…

 fileSaved

We click Done on the Form in the Debugger to close our Form.

 closeTheForm

Diagram Tab in the Debugger indicates that our Flow executed with no errors…

 flowDebugged

We locate and open first downloaded file, and confirm that its contents is a result of adding WordDocOne and WordDocTwo

 resultAppended

Then, we locate and open second File… It should contain data from WordDocOne, WordDocTwo, and WordDocThree.

 

 resultCombined

Additional Resources