Check if the Field is a String
| Definition: | isString(fieldname: str) → bool
|
| Description: | Checks if a specific field is of type, string. The return value can be further used to transform your data. For example, converting the string to a number. |
| Parameters: | fieldname: The name of the field whose value is to be checked. |
| Returns: | - True, if the specified field’s value is of type, string. - False, for null and other data type values. |
The following script checks if the specified property is a string:
from io.hevo.api import Event
def transform(event):
<existing_properties> = event.getProperties()
<boolean_value_type> = event.isString('<property_name>')
return event
Sample Transformation
The following script checks if the routing_number property is a string. The isString property displays the return value of the method:
from io.hevo.api import Event
def transform(event):
properties = event.getProperties()
# Set a property to the return value of the method
properties['isString'] = event.isString('routing_number')
return event
Sample Output
The Transformation sets the isString property to true, as the routing_number is a string.

Last updated on Jun 30, 2023