Diff

Overview

You can use this Snap to compare two sorted streams of documents (Original and New) and return four output streams: Deletions, Insertions, Modified, and Unmodified.

Ensure the first input is always New and the second input as Original in order for the Snap to display the output (insertions/deletions/modifications) in reference to the original document.

Note: This Snap does not handle arrays. You need to flatten an array into documents using the JSON Splitter, then sort the data before sending it to the Diff Snap.


  • This is a Transform-type Snap.
  • Does not support Ultra Tasks

Snap views

Type Description Examples of upstream and downstream Snaps
Input

This Snap has exactly two document input views: New and Original.

Ensure the first input is always New and the second input as Original in order for the Snap to display the output (insertions/deletions/modifications) in reference to the original document.

Output

This Snap has four document output views:

  • Deletions – Contains documents that exist in the Original view but not the New view.
  • Insertions – Contains documents that exist in the New view but not the Original view.
  • Modified – Contains documents that exist in both views but are different in some property.
  • Unmodified – Contains documents that are the same in both input views.
Learn more about Error handling.

Snap settings

Legend:
  • Expression icon (): Allows using pipeline parameters to set field values dynamically (if enabled). SnapLogic Expressions are not supported. If disabled, you can provide a static value.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field/Field set Type Description

Label

String

String Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: Diff

Example: Diff_new

Sort paths*

Use this field set to specify the list of paths to sort the two streams on.

Sort path* String

Specify the field/column name to sort the two streams on. Before comparing the two streams of data, they will be sorted by these paths, in the same order of the paths as specified in this field.

For example, to sort a list of person objects by the field firstname, enter $person.firstname.

Default value: None

Example: $person.firstname

Sort order (Global)* Dropdown list

Choose the order in which the two input streams have been sorted for the comparison. Allowed values are Ascending and Descending.

Default value: Ascending

Example: Descending

Output view mapping*

Use this fieldset to map the output view name to the output view type if you removed and re-added output views.

Tip: Though you can remove a mapping or change the order of the output views, we recommend that you do not alter the default mappings of names with types.
Output view name* Dropdown list

This is the name of the view in Views > Output Views. This value determines which result of the Diff operation is displayed in each of the four output views. Allowed values are Insertions, Deletions, Modified, and Unmodified.

Default value: One allowed view name per output view.

Example: Insertions

Output view type* Dropdown list

This is the type of output to be mapped with each output view in Views > Output Views. It is the result of the diff operation on each record between the two input streams. Allowed values are INSERTIONS, DELETIONS, MODIFIED, and UNMODIFIED.

Default value: One allowed view type per output view.

Example: DELETIONS

Snap execution

Dropdown list

Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Validate & Execute

Example: Disabled