Trying to pull a first name from the title of google calendar events

:bullseye: What is your goal?

I’m trying to get the first name of someone in a google calendar event title through a set multiple variables module. the calendar events are formatted like this:
“First Name Last Name- Private Facilitation”

:thinking: What is the problem?

I’m unable to isolate the first name by itself.

:test_tube: What have you tried so far?

I tried using multiple kinds of code to get the name using chatgpt. I can pull the full name from the event title with this code:
trim(substring(1.summary; 0; indexOf(1.summary; -)))

When I try replacing the ‘-’ with a blank space(" ") the variable comes up empty when I run the code.

:camera_with_flash: Screenshots: scenario setup, module configuration, errors

Hello @Esa_Hall,

Substring requires you to provide the first and last position of the substring that you want to take from the source. If you want the first word in a string, you can split on the space, but you will need to add the space like this: {{space}} :

{{substring(1.name; 0; indexOf(1.name; space))}}

Or otherwise, use the split and get functions:

{{get(split(1.name; space); 1)}}

Cheers,
Henk

Thank you so much! This was driving me crazy.