Start Free Trial

Alteryx Designer Desktop Discussions

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

Replace function for a column

cloh021
6 - Meteoroid

Hi Guru,

 

I have a column named "item name" with the below row items:

ItemName
Apple -- January
Pear -- January
Apple -- February
Apple -- March
Apple - December

How can I replace the month to Mmm and also replace -- to - at the same time?

 

Thanks in advance!

9 REPLIES 9
IraWatt
17 - Castor
17 - Castor

Hey @cloh021,

You could do this all at the same time with one formula tool using the regex replace and datetime parse. I've attached the a workflow which does it step by step which is a littler more understandable. The formula replaces '--' with '-' then the regex parse takes the information after the - which the datetime tools then convert to MMM. Finaly the formula tool replaces Month with MMM.

IraWatt_0-1653897620665.png

I've attached the workflow down below.

Any questions or issues please ask :)
HTH!
Ira

DataNath
17 - Castor
17 - Castor

One way of doing this @cloh021 :)

 

DataNath_0-1653898050731.png

 

Edit: Couldn't help myself, had to throw in the single tool option as @IraWatt mentioned!

 

DataNath_0-1653899054840.png

 

 

Qiu
21 - Polaris
21 - Polaris

@cloh021 
There is another way that we can prepare a static input, Month Vs Mon.
So we can use a Find and Replace tool to do it.

0530-cloh021.PNG

IraWatt
17 - Castor
17 - Castor

😆Nice one @DataNath ! looks a lot cleaner then what I thought it would look like.

binu_acs
21 - Polaris

@cloh021 Another way of doing this with the Left function 

 

binuacs_0-1653900850869.png

 

Qiu
21 - Polaris
21 - Polaris

@binu_acs 

That is a good one and OOTB thinking. 😀

ddiesel
13 - Pulsar
13 - Pulsar

@binu_acs One tool for the win! 

cloh021
6 - Meteoroid

Thanksss all Guruss! It all works! 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@ddiesel ,

 

You might like 1 expression within 1 tool (Formula) for the win :)

 

GetWord([ItemName], 0) + " - " + left(GetWord([ItemName], 2),3)

 

No RegEx for the Ex-tra points.

 

Cheers,

 

Mark

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels
Top Solution Authors