# Merge Transformation

*Merge* transformation combines records from two inputs into a single output stream with the same layout as the input streams. The output produced by *Merge* is sorted according to the selected key field for each of the two inputs. Any duplicate records are preserved in the resulting record set.

To add a *Merge* transformation, drag the *Merge* object from the *Transformations* group in the Flow toolbox and drop it on the dataflow.

An example of what a *Merge* object might look like is shown below.

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FdGDWHSNdP4SNLUYO6gCX%2F0.jpeg?alt=media)

To configure the properties of a Merge object after it was added to the dataflow, right-click on it and select Properties from the context menu. The following properties are available:

*Meta Object Builder* screen: It is used to add or remove fields in the field layout, as well as select their data type.

{% hint style="info" %}
**Note:** To quickly add fields to the layout, drag and drop the node *Output* port of the object whose layout you wish to replicate into the node *Input* port of the *Filter* object. The fields added this way show in the list of fields inside the node and as well as in the *Meta Object Builder*.
{% endhint %}

* *Merge Transformation Properties* screen: Using the Sort Input checkboxes, specify whether the left input, the right input, or both, need to be sorted.

Specify whether you want a case-sensitive match of the values in the key fields.

Finally, select the fields whose values will be used to match records between the two record sets.

* *General Options* screen: This screen shares the options common to most objects on the dataflow:
  * *Clear Incoming Record Messages*: When this option is on, any messages coming in from objects preceding the current object will be cleared. This is useful when you need to capture record messages in the log generated by the current object and filter out any record messages generated earlier in the dataflow.
  * *Do Not Process Records with Errors*: When this option is on, records with errors will not be output by the object. When this option is off, records with errors will be output by the object, and a record message will be attached to the record. This record message can then feed into downstream objects on the dataflow, for example, a destination file that will capture record messages or a log that will capture the messages and as well as collect their statistics.
  * The *Comments* input allows you to enter comments associated with this object.

## **Usage**

An example of a Merge transformation is shown below:

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FP1GmzVbEFR1lgwP3uExD%2F1.png?alt=media)
