Appending Word DocumentsLast 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.
Next, we Name the Flow and click Create to proceed to the Flow Designer.
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.
In the resulting Data Definitions window we click Add New.
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.
In the Data Definitions window we click Add to continue…
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.
In the Mapping Editor we select Build Array Mapping type for the WordDocuments Data Definition.
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.
After we have added all Documents to the Array, we change the outcome type to Array – Items.
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.
Our Word Documents for this Example look as following…
WordDocOne:
WordDocTwo:
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.
Then, we call Mapping Editor for this step…
In the Mapping Editor we connect WordDocOne to documentFileToAppend field and WordDocTwo to documentBeingAdded field. Then, save and close Mapping Editor.
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.
Then, we Show Mapping Editor for this step…
In the Mapping Editor we connect WordDocOne to the documentFileToAppend field. Then we choose Build Array Mapping type for the documentsBeingAdded field.
We connect WordDocTwo and WordDocThree as Items for the Array. Then, we click Ok to save and close Mapping Editor.
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.
This Form was designed for this tutorial. It has one Button control from Actions category and two File Download controls from File Handling category.
We select Show Mapping Editor option for the Download File Form step…
In the Mapping Editor we are going to use Build Data Mapping type for both File Download controls…
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.
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.
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.
Then, we click second File Download control to save Combined Multiple Word Documents file…
Decisions informs us that the File was saved…
We click Done on the Form in the Debugger to close our Form.
Diagram Tab in the Debugger indicates that our Flow executed with no errors…
We locate and open first downloaded file, and confirm that its contents is a result of adding WordDocOne and WordDocTwo…
Then, we locate and open second File… It should contain data from WordDocOne, WordDocTwo, and WordDocThree.