Fetch the Data Type of a Field
| Definition: | getType(fieldname: str) → str
|
| Description: | Gets the data type of the value in a specific field. |
| Parameters: | fieldname: The field whose data type is to be retrieved. |
| Returns: | A string containing the data type of the value in the specified field. |
The following script checks the data type of the specified property in an Event:
from io.hevo.api import Event
def transform(event):
<type_name> = event.getType('<property_name>')
return event
Sample Transformation
The following script demonstrates how this method can be used. It:
-
Retrieves the data type of the
Marksproperty. -
Adds a property called
typeto contain the name of the data type.
from io.hevo.api import Event
def transform(event):
eventName = event.getEventName()
properties = event.getProperties()
Type = event.getType('Marks')
properties['type'] = Type
return event
Sample Output
The Transformation fetches the data type of Marks and adds that as a new property called type to the Student.Sheet1 Event.

Last updated on Jun 30, 2023