Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Dynamic rename (Partial) based on condition

Nidhin
8 - Asteroid

Hi

 

I have a requirement to rename the columns based on certain conditions using a Dynamic Rename tool

 

If ( left(Current field Name,2)="R_" then replace ("R_" with "ABC_" ),else Current field Name end if

 

Here i need to replace certain parts of the field name with another name (not the value in these fields)

 

Is there a way to do it

 

Thanks

Nidhin

2 REPLIES 2
MDang
5 - Atom

Hello Nidhin,

 

Using Dynamic Rename Tool:

 

1) Rename Mode = "Formula"

2) Select all the fields to include

3) Example Expression below (I am sure there are different ways to write equivalent expression):

 

IF left([_CurrentField_],2) == "R_" THEN "ABC_" + right([_CurrentField_],length([_CurrentField_]) - 2)
ELSE [_CurrentField_]
ENDIF

 

Attached is also an Alteryx example.  Hope this helps.

 

mDang

Nidhin
8 - Asteroid

Hi @MDang 

 

Thanks

 

I used the below formula to achieve this

 

if left([_CurrentField_],2)="R_" then replace ([_CurrentField_],left([_CurrentField_],2),"ABC_") else "XYZ_"+[_CurrentField_] endif

 

I had to add prefix for both sets of data after an in Db join and remove the R_ at the same time

 

Nidhin

Labels