Retrieve the Event Name
Definition: | getEventName() → str |
Description: | Retrieves the name of the Event. |
Parameters: | This method does not take any arguments. |
Returns: | A string containing the name of the Event. |
The following script retrieves the name of an Event:
from io.hevo.api import Event
def transform(event):
# Get event name from the event #
<event_name> = event.getEventName()
return event
Sample Transformation
The following script demonstrates how this method can be used to filter Events named Clay County
:
from io.hevo.api import Event
def transform(event):
# Get the Event name
eventName = event.getEventName()
properties = event.getProperties()
# Filter Events #
if eventName == "Clay County":
return None
properties['County'] = eventName
return event
Sample Output
Based on the value of eventName in the sample Event:
-
The Event is filtered if its name is
Clay County
: -
A property named
County
is added to the Event if the name is notClay County
:
Last updated on May 30, 2023