Behavior of Pivot Snap when the Treat selected fields as static checkbox is selected

Scenario -1

This example pipeline demonstrates the behavior of the Pivot Snap on the selected fields when you apply Substitute empty strings and Null values on the target fields, but the selected fields exist in the input document.


CSV Generator configuration for scenario 1

Download this Pipeline

  1. Configure the CSV Generator Snap

    First, configure the CSV Generator Snap with the data as shown in the image.


    CSV Generator Snap output

  2. On validating, the Snap generates the output as follows.
    CSV Generator Snap output

  3. Configure the Pivot Snap and select the checkbox

    Next, configure the Pivot Snap as follows:

    • $Name: If this field does not exist, the Snap substitutes an empty string for this field in the output.
    • $['Last Date Available']: If this field does not exist, the Snap substitutes a null value for this field in the output.

    Select the Treat selected fields as static checkbox.


    Pivot Snap Configuration with selected fields

  4. Validate and view the output.

    On validating, the Snap generates the output as per the configured behavior for the Selected fields. That is, the Snap generates values for all the fields because the selected fields exist originally in the input document.


    Pivot Snap Ouput

Scenario -2

This example pipeline demonstrates the behavior of the Pivot Snap on the selected fields when you apply all the available options (Ignore, Substitute null, Substitute empty string, Substitute zero) on the target fields, and the selected fields do not exist in the input document.


CSV Generator configuration for scenario 2

Download this Pipeline

  1. Configure the CSV Generator Snap.
  2. First, configure the CSV Generator Snap with the data as shown in the image.
    CSV Generator Configuration

  3. On validating, the Snap generates the output as follows.
    CSV Generator Snap output

  4. Configure the Pivot Snap with field behavior and select checkbox.

    Next, configure the Pivot Snap with the following selected fields:

    • $Field01 — If this field does not exist, the Snap ignores and does not return anything in the output.
    • $Field02 — If this field does not exist, the Snap substitutes null value in the output.
    • $Field03 — If this field does not exist, the Snap substitutes an empty string in the output.
    • $Field04 — If this field does not exist, the Snap substitutes zero in the output.

    Select the Treat selected fields as static checkbox.


    Pivot Snap output when selected fields are absent

  5. Validate and view the output.
  6. On validating the Snap, the Snap generates the output as per the configured behavior for the Selected fields.
    Pivot Snap output when selected fields are absent

Scenario -3

This example Pipeline demonstrates the behavior of the Pivot Snap on the selected fields when they are nested in the input document.


JSON Generator configuration for scenario 3

Download this Pipeline

  1. Configure the JSON Generator Snap.

    First, configure the JSON Generator Snap with the data as shown in the image.


    JSON Generator Configuration

  2. Configure the Pivot Snap with nested fields and select checkbox.

    Next, configure the Pivot Snap with the following selected fields:

    • $StudentName: If this field is absent, the Snap substitutes an empty string in the output.
    • $Class: If this field is absent, the Snap substitutes zero in the output.
    • $Math.Stats: This is a nested field and the Snap substitutes a null value in the output.
    • $Math.Quants: This is a nested field and the Snap ignores it.

    Select the Treat selected fields as static checkbox.


    Pivot Snap output with nested fields flattened

  3. Validate and view the output.

    On validating the Snap, the Snap extracts the nested fields (that were included in the selected fields) to the root level and leaves the remaining nested fields outside the root level.


    Pivot Snap output with nested fields flattened

  1. Select the Treat selected fields as static checkbox in the Pivot Snap for all scenarios.
  2. Ensure correct configuration of selected fields based on the scenario.
  3. Observe the output to verify the substitution or omission behavior for existing, missing, or nested fields.