Select option string truncate

Hi everyone.
I have a select with a series of options that show 3 properties of the datasource e.g. Name Surname (City).
In the onChange event I have to update a text input but passing only the value of the first Name property.
How can I truncate the string at the first space?

You can use the split formatter for this. So if your expression returns John Doe (Paris) the following expression: your_expression.split(' ')[0] will return John

1 Like