Alteryx Designer Desktop Discussions

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

How to rename a column based on it's column position... e.g, F21 of F24?

SDJ57
8 - Asteroid

I have a dataset where I need to dynamically rename two columns based on their column position for changes made to reflect a new year. I am able to pull the field information and date into a stream where I use the Dynamic rename tool, but this isn't connected to the full dataset.

 

Thinking there should be an easier way to do this. Right now I am trying to transpose the columns to rows and then figure out a way to rename based on position this way. Below is a very simple visual of what I am needing to accomplish. Rename the name of the 4th column to a NewName.

 

SDJ57_0-1675452379062.png

 

17 REPLIES 17
ShankerV
17 - Castor

Hi @SDJ57 

 

One way to do this!!!

 

ShankerV_0-1675452788245.png

 

 

Many thanks

Shanker V

SDJ57
8 - Asteroid

Hi @ShankerV, thank you for your quick response! How could I do this is the name of "Column4" changes from year to year? I didn't explain that part well at all. So say, it starts as Column4 22, then the next year it is Column 423, but I need it to have the same name for both years. NewName.

 

So, it's the same file with the column name changing according to the year it is reporting in.

 

SDJ57_0-1675453244234.png

 

ShankerV
17 - Castor

Hi @SDJ57 

 

Just tweak my formula with contains() function.

It will work.

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @SDJ57 

 

Using the contains function.

 

IF contains([_CurrentField_],"Column4")
THEN "NewName"
ELSE [_CurrentField_]
ENDIF

 

ShankerV_0-1675453500297.png

 

Input was:

ShankerV_0-1675453579478.png

 

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @SDJ57 

 

Input changed for next year:

ShankerV_0-1675453654013.png

 

Output:

ShankerV_1-1675453684191.png

 

Many thanks

Shanker V

 

SDJ57
8 - Asteroid

Thanks again @ShankerV! The name changes from year to year. Is there a way to build in a formula to calculate current year and previous year as part of the contains? For example, contains("Column +"Previous Year") or contains("Column +"Next Year")?

ShankerV
17 - Castor

Hi @SDJ57 

 

Yes, sure we can give.

Can you please give me an example like Year will be in 2 digits or 4 digits like that.

 

Many thanks

Shanker V

SDJ57
8 - Asteroid

Oh yes, for example: "Year 2022" and "Year 2023" changed to "NewYear" for both files.

binuacs
20 - Arcturus

@SDJ57 One way of doing this

binuacs_0-1675454101377.png

 

Labels