# MERGEFORM Workflow Application

## Overview

The **MERGEFORM** workflow application takes multiple form data files and merges them into one file. It can also merge form archives into a target form archive by merging the HTML sections from both files.

## How it works

All parameters are optional, and parameter names can be set by the process designer. To copy a data from one to another, the only action required is to set the default value as the data to copy and set the data into which you want to retrieve it. The parameters’ directions must be INOUT. There is no limit to the number of parameters.

## Parameters

### Required parameters

| Parameter            | Type | Direction | Description                                                                                                                                                                                                                                                                                                                                                                                                           |
| -------------------- | ---- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `FORM_DATA`          | File | INOUT     | The merge target `FORM_DATA`. All `FORM_DATA_SOURCE` parameters will merge into this parameter’s default value (IN) and will update the specified data (OUT) with the result.                                                                                                                                                                                                                                         |
| `FORM_DATA_SOURCE1`  | File | IN        | Specific form data to merge into the target form data.                                                                                                                                                                                                                                                                                                                                                                |
| `FORM_FIELDS_MERGE1` | Text | IN        | <p>The fields to merge from <code>FORM\_DATA\_SOURCE1</code> to <code>FORM\_DATA</code>, separated by commas. It supports the asterisk (<code>\*</code>) wildcard character to select all fields starting with the prefix.</p><p></p><p>✏️ <strong>Note:</strong> If you don’t specify a <code>FORM\_FIELDS\_MERGE\[N]</code> parameter, all of the fields in <code>FORM\_DATA\_SOURCE\[N]</code> will be merged.</p> |

### Optional parameters

| Parameter                   | Type | Direction | Description                                                                                                                                                                                                          |
| --------------------------- | ---- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `FORM_DATA_SOURCE[2..N]`    | File | IN        | Specific form data to merge into the target form data.                                                                                                                                                               |
| `FORM_FIELDS_MERGE[2..N]`   | Text | IN        | The fields to merge from `FORM_DATA_SOURCE[2..N]` to `FORM_DATA`. It also supports the wildcard character.                                                                                                           |
| `FORM_ARCHIVE`              | File | INOUT     | The merge target `FORM_ARCHIVE`. All `FORM_ARCHIVE_SOURCE` parameters will merge into this parameter’s default value (IN) and will update the specified data (OUT) with the result.                                  |
| `FORM_ARCHIVE_SOURCE[1..N]` | File | IN        | Specific form archive to merge into the target form archive.                                                                                                                                                         |
| `FORM_FIELDS_ARCHIVE[1..N]` | Text | IN        | Section IDs to merge from `FORM_ARCHIVE_SOURCE[1..N]` to `FORM_ARCHIVE`, separated by commas. It does not support the asterisk wildcard parameter; instead, you must specify the exact IDs of each section to merge. |

### Examples of parameters

| Parameter              | Type | Direction | Description                                                                                      |
| ---------------------- | ---- | --------- | ------------------------------------------------------------------------------------------------ |
| `FORM_DATA`            | File | INOUT     | <p>Send value of <code>FORM\_DATA</code><br>Receive value of <code>FORM\_DATA</code></p>         |
| `FORM_DATA_SOURCE1`    | File | IN        | Send value of `FORM_DATA_VALIDATES_ACCOUNTING`                                                   |
| `FORM_FIELDS_MERGE1`   | Text | IN        | Send value of `ACCOUNT_*`                                                                        |
| `FORM_DATA_SOURCE2`    | File | IN        | Send value of `FORM_DATA_VALIDATES_SALES`                                                        |
| `FORM_FIELDS_MERGE2`   | Text | IN        | Send value of `SALES_DECISION,SALES_COMMENT`                                                     |
| `FORM_ARCHIVE`         | File | INOUT     | <p>Send value of <code>FORM\_ARCHIVE</code><br>Receive value into <code>FORM\_ARCHIVE</code></p> |
| `FORM_ARCHIVE_SOURCE1` | File | IN        | Send value of `FORM_DATA_VALIDATES_ACCOUNTING`                                                   |
| `FORM_FIELDS_ARCHIVE1` | Text | IN        | Send value of `ACCOUNT`                                                                          |
| `FORM_ARCHIVE_SOURCE2` | File | IN        | Send value of `FORM_ARCHIVE_VALIDATES_SALES`                                                     |
| `FORM_FIELDS_ARCHIVE2` | File | IN        | Send value of `SALES`                                                                            |
