Alteryx Designer Desktop Discussions

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

Trim Function

jonick1205
7 - Meteor

Anyone can help to solved this problem i need only the first 4 digit to show on my report. for example 202012354866 i need to show 2020 only

4 REPLIES 4
KarolinaRoza
11 - Bolide

hi,

 

Please try with Formula tool with formula:

 

left(tostring([Field1]),4)

 

Regards,

Karolina

Maskell_Rascal
13 - Pulsar

Hi @jonick1205 

 

So there are numerous ways to get to this data, but they all require you to first convert the field in question to a string. Below are three different examples. 

Maskell_Rascal_0-1624546924294.png

 

If you have data in the field prior to your numbers, then we'd need to modify the regex solution to make it work. 

 

If this solves the problem please mark answer as correct, if not let me know!

 

Cheers!

Phil

KarolinaRoza
11 - Bolide

Hi,

I was to fast with reply 🙂 in case you will have other characters in your input then Regex will be useful:

KarolinaRoza_0-1624547111300.png

 

 

Karolina

 

MichaelSu
Alteryx Alumni (Retired)

See attached. All of the solutions posted should work as well. It's mostly a matter of preference.

 

Thanks,

Mike

Labels