We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Title case the first word of a line

Jean-Balteryx
16 - Nebula
16 - Nebula

Hi community !

 

I come up with a question that I think, you will solve easily, but that I can't figure out.

 

I have few rows containing many words and my goal is to title case the first word only. I've tried formulas and regex but can't find a way to achieve it.

 

I could split my rows word by word, add a record ID and if the ID is 1 title case the word then concatenate back but I'm sure there is a simpler way to do this.

 

Do you have any idea ?

 

Thank you for your replies and I hope that everybody is fine !

 

Have a great day 🙂

 

Cheers,

 

Jean-Baptiste

9 REPLIES 9
atcodedog05
22 - Nova
22 - Nova

Hi @Jean-Balteryx ,

 

Can you split the first word and rest of the string into 2 columns using Text to column.

 

Use a formula tool to titlecase the first word and later concatenate with rest of the sentence.

 

Hi hope this helps.

 

Cheers and Happy Analyzing : )

Jean-Balteryx
16 - Nebula
16 - Nebula

Hi @atcodedog05 ,

 

Thank you for your solution ! 🙂

I think I can split in two using a Regex tool ! I'll try it.

 

I'm also looking for a solution that doesn't need to split the row but I'm not sure it's possible.

 

Cheers !

 

Jean-Baptiste

atcodedog05
22 - Nova
22 - Nova

Hi @Jean-Balteryx 

 

Found this. You accomplish the task with only a formula tool.

 

https://community.alteryx.com/t5/Alteryx-Designer-Ideas/Custom-Functions/idi-p/467216#M9578

 

Sorry it was a submitted idea.

 

You can use REGEX_Replace([FieldName], " (.*)\s.*", TitleCase(#1))

 

I currently dont have access to Alteryx to check. But the formula would look like that.

Jean-Balteryx
16 - Nebula
16 - Nebula

Hi @atcodedog05 ,

 

I tried with REGEX_REPLACE but somehow the function TitleCase or any other isn't applied. 😕

 

Jean-Baptiste

atcodedog05
22 - Nova
22 - Nova

Hi @Jean-Balteryx ,

 

I got access to my designer and was able to work it out.

 

Here is the hack. This was a great  exploration for me too.

atcodedog05_0-1589470333468.png

atcodedog05_2-1589470393188.png

The formula.

 

atcodedog05_1-1589470363883.png

 

I hope this helps. Would love to hear back from you.

 

estherb47
15 - Aurora
15 - Aurora

Hi @Jean-Balteryx 

If by Title Case on the first word, you can split off just the first character and make it uppercase, then leave the rest of the string as is.

 

In a formula tool, you can use:

 

Uppercase(Left([Field],1))+right([Field],Length([Field])-1)

 

This takes the first character of the string, makes it uppercase, and then joins to the remaining characters in the string (from the right side, take the total length of the string and subtract 1 because we've already dealt with the first character)

Let me know if that helps

Cheers!

Esther

atcodedog05
22 - Nova
22 - Nova

Man why didnt i think about this.

 

This is amazing @estherb47 : )

estherb47
15 - Aurora
15 - Aurora

@atcodedog05 , it's the power of solving together! One idea triggers another. That's what I love most about this community!!

 

Cheers,

Esther

Jean-Balteryx
16 - Nebula
16 - Nebula

Hi @estherb47 and @atcodedog05 ,

 

You are both awesome, your solutions work ! You saved the day !

 

I love to see this solving process every time !

 

Thank you very much 🙂

 

Cheers,

 

Jean-Baptiste

Labels
Top Solution Authors