Alteryx Designer Desktop Discussions

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

Dynamic Rename to add Spaces?

Bren312
8 - Asteroid

Hi all, I've got a question regarding the Dynamic Rename tool which I'm hoping to get some help with.  I'm importing a CSV file which has all Column Header titles mashed together like so:  VendorClaimNumber; ItemName; CountryClaim, etc.

 

I'm looking for a way to dynamically add a space between the Capital Letters to change the headers to Vendor Claim Number, Item Name, etc.  

 

I've tried a REGEX_Replace ([_CurrentField_],"\u","\s") and that didn't do it...any ideas?  Thanks everyone!

 

Bren

6 REPLIES 6
CharlieS
17 - Castor
17 - Castor

Hi @Bren312 

 

I used a few more tools than just a Dynamic Rename, but it should be easy to follow. Check out the attached workflow to see how I used RegEx to identify capitalized words, rebuild them with spaces, and rename all the fields of the original data stream.

 

20200309-RenameWithSpaces.PNG

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Bren312 ,

 

This is more involved because you need to dynamically address the replacement of Capital Letters with SPACE+Capital Letter (except the first).  I created a replacement table for field names as shown below:

 

capture1.png

 

I hope that this helps and possibly teaches you something.  If someone else comes up with a cleaner solution, I'll be interested.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
MarqueeCrew
20 - Arcturus
20 - Arcturus

@CharlieS ,

 

In my solution I accept values with spaces as names and don't mess with them.  I know that it wasn't a stated requirement, but I did add that feature.

 

Cheers,


Mark

Alteryx ACE & Top Community Contributor

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

Top notch; thanks Mark!  Your workflow definitely taught me some things and I appreciate you taking a look at this.  Thanks again and all the best!

 

Bren

Bren312
8 - Asteroid

Hi Charlie, thanks for taking a look at this.  I like your solution; it's pretty sleek.  Thanks again and all the best!

 

Bren

kpayne
5 - Atom

Thank you!! This was exactly what I was looking for. :)  Worked perfectly. 

Labels