How to select first name from user name column

Hi:

I want to select the first name from the list if users so that I can create a greeting like: “Hi John” - but the user column includes second name too. I am sure it must be easy - but not sure how to do it.

I would appreciate your help.

Thanks

Paul

1 Like

This is an experimental reply from a bot. Please like it if it’s correct.

You can use the Split Text action to separate the first and last name from the user name column. This action will split the text into two parts, based on a separator you specify. You can then use the first part of the split text as the first name. Learn more about the Split Text action here. Glide • User profile columns

1 Like

The answer above is half right. Split the Full Name at the space and then use a single value column to get the first value of the split text column (which would be the first name).

4 Likes

For a single column solution, you can use the Extract Matching Text plugin with the following regular expression:

^(^[\S]+)

Or you could use a JavaScript column with the following code:

return p1.split(' ')[0];

2 Likes

Thanks. I’ve done this and it works. The first time I tried the single value was the first name of the first person in the user list - then repeated throughout the column. I tried again and it has produced a list of different names (even though it is the single value column). I don’t really understand the logic - but it is working. So thanks.

1 Like

Thanks. I’ve tried both the split text method and your JavaScript suggestion - which works well. Unfortunately I don’t know anything about JavaScript - so cannot understand WHY or HOW it works - but the fact that it does very neatly is cool. Thanks

It works in a very similar way as the Split Text + Single Value method that Bob gave you.

The JavaScript split() function accepts an input parameter, and will attempt to split it using the separator that you provide - the quoted bit inside the parentheses, in this case a single space.

As with the Split Text column, the JavaScript split() function will return an array. In this case, we only want the first element of the array, and the way we access that is by tagging the [0] on the end.

So it basically does exactly the same as Split Text + Single Value → First, but combines them both into a single step.

Or… we could just ask ChatGPT to explain it :wink:

2 Likes

Hi:

Sorry for not replying - for some reason your message got lost in my inbox. The ChatGPT explanation is amazing - I am really impressed by it. So clear.

Thanks for your help.

Paul

1 Like