Alteryx Designer Desktop Discussions

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

Remove everything to left of character with dynamic rename

dsucci
6 - Meteoroid

Hello!

So I'm currently trying to rename my column headers with the dynamic rename tool but when I try to use the REGEX_replace it seems to not be working and I feel like I am missing something very obvious. I'm attempting to remove any of the numbers I had added before the underscore plus the underscore itself in order to clean up the column headers,

So instead of having "1_Name", it would be just "Name" Or if down the line it had more than 1 digit such as "25_food" it could also make it just "food"

 

this all came from myself trying to make the cross tab tool not output in alphabetical order so this seemed like a simple enough solution, but it appears that's not the case haha. Any feedback is greatly appreciated!

4 REPLIES 4
Felipe_Ribeir0
16 - Nebula

Hi @dsucci 

 

To remove the number_ from the field names you can use the bellow expression. The example workflow is attached. 

 

Felipe_Ribeir0_0-1663584867020.png

 

If the provided answer helped you to solve the problem/was correct, please accept it as a solution :)

 

Thanks.

MarqueeCrew
20 - Arcturus
20 - Arcturus

@dsucci ,

Given, 25_LastName

 

findstring([name],"_")  

 

will return 2

 

Substring([name],findstring([name],"_") ,)

 

 should return the rest of LastName

 

 cheers,

 

 mark

 

 regex(_replace([name],".*?_(.*}",'$1')

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Emmanuel_G
13 - Pulsar

Hi @dsucci ,

 

The issue comes from \s in your regex. \s means that there is a white space after digits and it is not the case in headers.

 

Instead of using \s, replace it with "_" and it will work.

 

Find details in attachement. Let me know if there is any issue.

 

Please do not hesitate to mark this answer as solution if it helped.

Emmanuel_G_0-1663585061699.png

 

dsucci
6 - Meteoroid

Thank you @Felipe_Ribeir0 it seems that has done the trick, though everyone else gave very insightful replies as well that i'll look more into for the future.

Labels