Alteryx Designer Desktop Discussions

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

Dynamic Rename Formula

tom90
6 - Meteoroid

I am looking to rename multiple columns into the same formatting with the dynamic rename tool however I am stuck when combining different variations. 

 

Example of column names input:

 

t0_bw_column1__c 

t0_column2__c 

__column3__

 

Output:

 

TT_column1

TT_column2

TT_column3

 

I am able to use the replace formula to perform part of what I need for example replacing "t0_bw_" to "TT_" however cannot workout how to combine all the criteria into one expression.

 

Thanks

 

 

6 REPLIES 6
DataNath
17 - Castor

@tom90  With the field names being somewhat unstructured, I'd look to use something like this, assuming there's always the 'columnX' part which is what you're looking for:

 

Regex_replace([_CurrentField_], '.+(column\d+).+', 'TT_$1')

 

Before

DataNath_0-1661257119403.png

 

After:

DataNath_1-1661257142555.png

tom90
6 - Meteoroid

Thanks for the reply

 

annoyingly the column name will change constantly.

 

It could be:

 

ID

CreatedDate

LastEditedDate

 

ECT

DataNath
17 - Castor

Can you provide a more extensive list of possibilities and what they should all be converted to? From your initial example it just looked like they were all ...ColumnX... but if not then the formula will definitely need more work or even extra tools to help standardise them.

tom90
6 - Meteoroid

Sorry I should have been more specific with the columns names. A more extensive list below:

 

t0_bw_Id__c

t0_bw_Current__c 

t0_bw_ClientName__c 

t0_bw_ClientAddress__c 

t0_bw_JoinClientName__c 

t0_bw_StartDate__c

 

t0_CreatedDate__c

t0_LastModifiedDate__c 

t0_OwnerId__c 

 

__toDate__

__fromDate__

 

Anything before the name replaced with a prefix of CC_ and anything trailing after the name removed 

 

 

Hope that give you more info

Thanks

DataNath
17 - Castor

Does something like this work better? Assuming that the extensive list above includes all of the possible current pre & suffixes. Could do this with regular string functions but would have to nest several as far as I can see.

 

Before

DataNath_0-1661258992237.png

 

After

DataNath_1-1661259012040.png

tom90
6 - Meteoroid

That's great, thanks for your help

Labels