Examples of Drag and Drop Transformations
Example 1: Adding a Field to an Event
In this example, we will:
-
Add the
discount
field to the Event Typecatalog.book
, with a value as 0.15*price. The schema of thecatalog.book
Event Type is provided here: -
Test the transformation.
-
Filter the Events to add the
discount
field ONLY IF the value of theprice
field exceeds $20.
Adding the discount
field to catalog.book
Event Type
-
Click the Transformations icon in the Pipeline toolbar.
-
In the Transformations UI, drag the Add a Field transformation block to the canvas.
-
Click the BUILD button in the top left of the canvas.
-
In the right pane, filter the fields on which the transformation must be applied:
-
Click ADD FILTER +.
-
Click Event Type.
-
In the SELECT OPERATOR drop-down list, click Equals.
-
Specify the Value as catalog.book.
-
Click ADD FILTER.
-
-
Specify the new field details in Settings:
-
Specify the New Field Name as discount.
-
Specify the New Field Value as 0.15*price.
-
Test the Transformation
-
In the canvas, click TEST.
-
In the right pane, select the
catalog.book
Event Type and click GET SAMPLE. -
Click TEST.
-
View the newly added
discount
field in the test results. It is calculated as 15% of the price. -
Optionally, click GET SAMPLE to test on more Events.
Filtering Events for adding the discount
field
-
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.
-
Click on the Add a Field transformation block.
-
In the right pane, click ADD FILTER +, and click Event Field.
-
In the Field Name field, enter
price
, and click SELECT FIELD. -
In the SELECT OPERATOR drop-down list, select Greater Than.
-
In the Value field, enter 20 and click ADD FILTER +.
-
Repeat Step 2 to test the new transformation. Click GET SAMPLE to test Events with different price values.
Results:
Where price is greater than $20, the discount
field is added:
Where price is less than $20, the discount
field is not added: