Alteryx Designer Desktop Discussions

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

Trim function on a string ?

Brad1
11 - Bolide

Hi,

 

How do I get from:  1234567890

 

To:  456

 

?

 

Thanks in advance.

12 REPLIES 12
Brad1
11 - Bolide

TrimRight([your_field_here],'county')

mcultrera
8 - Asteroid

I got it to work by using Replace instead of TrimRight

 

Replace([County], ' County', '')

 

It's not limited to only the right side of the field though.

 

tessaenns
9 - Comet

I stumbled across this thread after typing in “trim functions in Alteryx” into my google search bot and wanted to take a quick moment to say 2 things here...

 

First, great question and great responses!

 

Second, though all the functions above are beautiful and creative and most important, they work! I would advise anyone with a similar question to first and foremost plop a select tool in front of your data and look at the data type. The trim function, for example does not react well to ‘numeric’ data types. With that said, before copying and pasting functions into your formula tool only to see ugly red error messages, check your data type because you may just need to convert a field or two and be on your way again. 

 

Lucky for us, Alteryx makes data type conversions  super easy with the select tool (it is literally a drop down and select menu) and then off you go back to your formula! Alteryx also has documentation to refer to so you don’t have to pain stake every data type nuance on your own. (Google search Alteryx functions documentation)

 

This is not a solution, just a friendly reminder for someone who might find it useful in their journey! 🙂 

Labels