I would like to extract the first name from a name and surname field. This field is called 'Title' and is being fetched from a SharePoint list. I am using the following guide to help:
https://powerusers.microsoft.com/t5/General-Power-Automate/Return-First-word-in-a-string/td-p/83522
However, I am having trouble in extracting the number of characters before the space between the name and surname. Here is what I have tried:

While the flow runs, rather than returning the number of characters between the first name and surname, it simply returns the input expression, including the name itself:

Next, I tried typing the formula into the expression area:

However this fails with the message: "Unable to process template language expressions in action 'Compose' inputs at line '1' and column '53550': 'The template language function 'indexOf' expects its first parameter to be of type string. The provided value is of type 'Null'.":

This doesn't make sense because as its clear in the second screenshot, the 'Title' is being retrieved and so cannot be null.
Any help would be appreciated. Thanks.