Field Zip

The Field Zip processor merges list data from two fields into a single field. You can use the Field Zip processor to merge two List fields or List-Map fields. Use the processor to merge related lists of data.

The Field Zip processor merges list data with a corresponding list. If either list includes more items than the other, the extra list items are not merged. The processor retains the original list fields so no data is lost.

When you configure the Field Zip processor, you specify the two fields to merge and the field to write the merged data. By default, the processor merges the field names and values from the lists. You can configure the processor to merge only the values.

If one or both fields in a record do not match the specified fields to merge, you can configure the Field Zip processor to pass the record as is without merging any fields, or pass the record to the pipeline for error handling.

Merging List Data

When merging data in List fields, the Field Zip processor merges each item in a list with the corresponding item in the other list. The processor merges the lists using the order of the lists, and returns a list of Map fields.

Any item in a list without a matching item in the other list is not merged.

For example, say you have a record with two List fields:
order itemID cost
23523482
  • 2
  • 113
  • 954
  • 6502
  • 89.95
  • 8.95
  • 6.95

Say you configure the Field Zip processor to merge the ItemID and Cost fields and write the data to a Purchase field. The Field Zip processor then generates the following record:

In the Purchase field, the merged data is a list of Map fields. Each map has the field name and value in the ItemID list merged with the corresponding field name and value from the Cost list. Notice that the fourth ItemID, /ItemID/3, is not included in the merged list because it has no corresponding cost information.

If you configure the Field Zip processor to merge only the values, the processor returns the same data without the original field names, as follows:

Merging List-Map Data

As with List fields, when merging data in List-Map fields, the Field Zip processor merges each item in a list with the corresponding item in the other list. The processor merges the lists using the order of the lists, and returns a list of Map fields.

The difference is, the lists in the Map fields include different pairs of information, rather than the matching pairs of information from List fields.

For example, say you have a record with two List-Map fields, each with a single map in the list:
basics additional
0
  • id: 23
  • color: 20005
  • info: <null>
0
  • inventory: 80
  • cost: $5.98

Say you configure the Field Zip processor to merge the Basics and Additional List-Map fields and to write the results to an All field. The Field Zip generates the following record:

Notice how each map contains a different set of fields. When processing List fields, Field Zip returns the matching sets of fields. Also notice, the /Basics/Info field is not included because it has no corresponding item in the other List-Map field.

If you configure the Field Zip processor to merge only the values, the processor returns the same data without the original field names, as follows:

Pivoting Merged Lists

Depending on your use case, you might want to add a Field Pivoter processor to your pipeline after merging list data with the Field Zip processor.

The Field Pivoter can pivot merged list data and create a record for each first-level item in the list.

For example, say you use the Field Pivoter to process the data generated in the first List example, above, with field names included in the merged list. You configure the Field Pivoter to write the pivoted data to a new field called Purchased_Item.

The pivot of the single record results in the following three records from the merged list:
Order ItemID Cost Purchase Purchased_Item
23523482
  • 2
  • 113
  • 954
  • 6502
  • 89.95
  • 8.95
  • 6.95
      • itemID: 2
      • cost: 89.95
      • itemID: 113
      • cost: 8.95
      • itemID: 954
      • cost: 6.95
    • itemID: 2
    • cost: 89.95
23523482
  • 2
  • 113
  • 954
  • 6502
  • 89.95
  • 8.95
  • 6.95
      • itemID: 2
      • cost: 89.95
      • itemID: 113
      • cost: 8.95
      • itemID: 954
      • cost: 6.95
    • itemID: 113
    • cost: 8.95
23523482
  • 2
  • 113
  • 954
  • 6502
  • 89.95
  • 8.95
  • 6.95
      • itemID: 2
      • cost: 89.95
      • itemID: 113
      • cost: 8.95
      • itemID: 954
      • cost: 6.95
    • itemID: 954
    • cost: 6.95

Configuring a Field Zip Processor

Use a Field Zip processor to merge two corresponding list fields in a record.

  1. In the Properties panel, on the General tab, configure the following properties:
    General Property Description
    Name Stage name.
    Description Optional description.
    Required Fields Fields that must include data for the record to be passed into the stage.
    Tip: You might include fields that the stage uses.

    Records that do not include all required fields are processed based on the error handling configured for the pipeline.

    Preconditions Conditions that must evaluate to TRUE to allow a record to enter the stage for processing. Click Add to create additional preconditions.

    Records that do not meet all preconditions are processed based on the error handling configured for the stage.

    On Record Error
    Error record handling for the stage:
    • Discard - Discards the record.
    • Send to Error - Sends the record to the pipeline for error handling.
    • Stop Pipeline - Stops the pipeline.
  2. On the Zip tab, configure the following properties:
    Field Zip Property Description
    Fields to Zip Configure the fields to merge and the output field as follows:
    • First Field - The first List or List-Map field to use.
    • Second Field - The second List or List-Map field to use.
    • Path for Zipped Field - The field where the processor writes the merged list data.
    Zip Values Only Includes only field values when merging lists. When not selected, the processor includes field names and values.

    For more information about how the processor merges list data, see Merging List Data.

    Field Does Not Exist
    Action to take when one or both list fields do not exist in a record:
    • Include without Processing - Passes the record as is without creating the merged field.
    • Send to Error - Passes the record to the pipeline for error handling.