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

Mass Rename columns

Riot
8 - Asteroid

So I have a bunch of columns like Red1, Red2... Red10, Red11 and I want to rename them to all have two digits, so Red01, Red02, etc. 

Is there a  more efficient way to rename all of those other than using a select tool and manually doing it ?

5 REPLIES 5
JohnJPS
15 - Aurora

You could check the Dynamic Rename tool, (under the developer tab) which will allow you to mass rename using a formula with REGEX_Replace in it, (e.g. to replace [0-9] with a preceding zero).

MarqueeCrew
20 - Arcturus
20 - Arcturus

Robert,

 

Here is a formula that yields something similar to what you've asked for.  Maybe not the best logic, but it should get the job done for you.

 

IF REGEX_MATCH([_CurrentField_],"([[:alpha:]]+)(\d{1})")
THEN REGEX_REPLACE([_CurrentField_],"([[:alpha:]]+)(\d)","$1_0$2")
ELSE REGEX_REPLACE([_CurrentField_],"([[:alpha:]]+)(\d)","$1_$2")
ENDIF

 

Thanks,


Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Riot
8 - Asteroid

When I use that formula, it changes it to Red_01   is their anyway to eliminate that _  I imagine another regex ? 

MarqueeCrew
20 - Arcturus
20 - Arcturus

Robert,

 

Only for you ...

 

IF REGEX_MATCH([_CurrentField_],"([[:alpha:]]+)(\d{1})")
THEN REGEX_REPLACE(REGEX_REPLACE([_CurrentField_],"([[:alpha:]]+)(\d)","$1_0$2"),"([[:alpha:]]+)(_)(\d)","$1$3")
ELSE REGEX_REPLACE([_CurrentField_],"([[:alpha:]]+)(\d)","$1$2")
ENDIF

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Riot
8 - Asteroid

You saved me this morning!

Labels
Top Solution Authors