Fetch the Data Type of a Field

Last updated on Jun 30, 2023
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:

  1. Retrieves the data type of the Marks property.

  2. Adds a property called type to 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.

Get Data Type



Revision History

Refer to the following table for the list of key updates made to this page:

Date Release Description of Change
Feb-14-2023 NA New document.

Tell us what went wrong