Skip to main content
Level 3
Oct 6, 2019 4:32 AM UTC
Question

Substring First name from Full name using advance expression

Hi all,

I'm trying to extract first name from full name using Substring(@fullName,1,Charindex(" ",@fullName))

However, it does not work. My Charindex returns 0.  Can someone help me with this?

Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Level 3
Oct 7, 2019 3:48 AM UTC

Thanks so much Anita.

I'm trying to substring only when there's a space. However, I got a case function error for the expression below. Can you help?

Thanks again!

Case(When(@fullName LIKE ' ', Substring(@fullName,0,Charindex(@fullName, " ")), Else(@fullName)))

Translate
Anita_punmiya
Level 5
Oct 6, 2019 10:42 PM UTC

Hi Michelle,

The index of Substring starts with "0".

Try below expression. This should work.

Substring(@fullName,0,Charindex(@fullName," "))

Thanks,

Anita

Translate