Examples of Drag and Drop Transformations

Last updated on May 30, 2023

Example 1: Adding a Field to an Event

In this example, we will:

  1. Add the discount field to the Event Type catalog.book, with a value as 0.15*price. The schema of the catalog.book Event Type is provided here:

    catalog.book schema map

  2. Test the transformation.

  3. Filter the Events to add the discount field ONLY IF the value of the price field exceeds $20.

Adding the discount field to catalog.book Event Type

  1. Click the Transformations icon in the Pipeline toolbar.

  2. In the Transformations UI, drag the Add a Field transformation block to the canvas.

  3. Click the BUILD button in the top left of the canvas.

  4. In the right pane, filter the fields on which the transformation must be applied:

    1. Click ADD FILTER +.

    2. Click Event Type.

    3. In the SELECT OPERATOR drop-down list, click Equals.

    4. Specify the Value as catalog.book.

      Add Event Type filter

    5. Click ADD FILTER.

  5. Specify the new field details in Settings:

    1. Specify the New Field Name as discount.

    2. Specify the New Field Value as 0.15*price.

      Add field settings

Test the Transformation

  1. In the canvas, click TEST.

    Test transformation

  2. In the right pane, select the catalog.book Event Type and click GET SAMPLE.

  3. Click TEST.

  4. View the newly added discount field in the test results. It is calculated as 15% of the price.

    Add field to Event Type

  5. Optionally, click GET SAMPLE to test on more Events.

Filtering Events for adding the discount field

  1. Click BUILD in the left pane to return to the transformation settings. Or, click the Edit icon next to the transformation block to return to Build mode.

  2. Click on the Add a Field transformation block.

  3. In the right pane, click ADD FILTER +, and click Event Field.

  4. In the Field Name field, enter price, and click SELECT FIELD.

    Add Field Filter

  5. In the SELECT OPERATOR drop-down list, select Greater Than.

  6. In the Value field, enter 20 and click ADD FILTER +.

    Price greater than 20

  7. Repeat Step 2 to test the new transformation. Click GET SAMPLE to test Events with different price values.


Where price is greater than $20, the discount field is added:

The discount field is added

Where price is less than $20, the discount field is not added:

The discount field is not added

Tell us what went wrong