Special Keywords
Hevo provides the following keywords to help with creating advanced Transformations.
The $self Keyword
Use the variable $self
to reference the value of the field on which the Transformation is being applied.
Sample Transformation
Scenario: if the value of the field isactive
in the Event Type deals
equals false, then, increase the price
by 20%.
Here, you can use the $self variable as follows:
Filters:
Event Type = deals
Event Field isactive
= false
Fields = All fields with names = price
Settings:
Enter value or formula = 1.2* $self
Result: When you test the Transformation, the value of the price field is increased from 641 to 769:
The $null Keyword
The $null
keyword can be used when you want to add fields or update existing field values with a null value. Since all null fields are dropped when Hevo ingests your data, you can create transformations with this keyword to include them again. Or, you may want to assign null values to fields based on some conditions rather than dropping them altogether.
The following sequence of two t\Transformations illustrate the usage of the $null
field.
1. Change Field Value
For Event Type = shop
and Event Field = price
, change the value of price
to $null
. The field with its null value is not displayed in the test results.
2. Add a Field
Now, in the Events transformed in step 1 above, for Event Field = price
and Event Field Value Is Null
, add a field count
with Value, Out-of-Stock
. The transformation is applied successfully and can be verified in the results, confirming the behavior of the $null
keyword.
The settings appear as follows:
Result: The final output of the two Transformations appears as: