Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Dynamic Rename of Headers

MojoRisen
7 - Meteor

Hello, I am trying to rename column hears based on a text input file. For example in my workflow my column headers read "Year 1 Cash", "Year 2 Cash", & "Year 3 Cash" Respectively. I want to be able to change those years to whichever year I am analyzing. So for example I want the output to say "2020 Cash", "2021 Cash", & "2022 Cash" if I am analyzing 2020, 2021, & 2022. The years change often so was thinking using an input file to change the years in one spot, and, since I output multiple different files and tabs with the same headers, it might be easier to do it one single location. 

9 REPLIES 9
alexnajm
17 - Castor
17 - Castor

Dynamic Rename tool is your friend here! What I'd do is create a column in that Text Input to basically map the name in the file to the name in the Text Input. You can create this column manually but better to calculate this dynamically using a Multi Row Formula in some capacity. then use the Dynamic Rename to rename accordingly

MojoRisen
7 - Meteor

Agreed - but having difficulty getting the output I want using the tool. 

OTrieger
12 - Quasar

@MojoRisen 

There are many ways how you can do it, however this will be the basic operation.

Use Dynamic Rename tool for that
You would like to end with 2 fields one with relevant years one and one with the original headers.
Now with a Replace tool you can create the new Header in the column with the year. Now you will have the updated text.
What left to do, is to connect it to the Dynamic renaming tool and replace the original headers with the new headers

alexnajm
17 - Castor
17 - Castor

@MojoRisen then you'll have to share more about your current workflow for us to help further!

ChrisTX
16 - Nebula
16 - Nebula

Can you use an expression in the Dynamic Rename formula, where the expression includes DateTime functions like DateTimeNow, ToDate.   and ToString ?

 

What type of logic would you use to convert Year 1 to 2020, Year 3 to 2022?

 

Can your earliest date like 2020 be linked to current date or data in the input file?

 

MojoRisen
7 - Meteor

Basically - Headers will always be a specified in the workflow - "Year 1 Cash", Year 2 Cash", "Year 3 Cash". I am analyzing other financial line items in addition to cash but all line items would be for the same 3 years in this example. In all of my output files I would like the headers to be whichever specific three years I am analyzing. In my Example above the output headers would read  "2020 Cash", "2021 Cash", & "2022 Cash" if I am analyzing 2020, 2021, & 2022. 

alexnajm
17 - Castor
17 - Castor

To @ChrisTX 's question, how are we to know what years you want to use? This is where seeing your current data structure and workflow will be beneficial

MojoRisen
7 - Meteor

Thank you, please see my response above. I will specify those years in the input file. 

alexnajm
17 - Castor
17 - Castor

@MojoRisen at this stage a .yxzp of the workflow & data will be most beneficial - go to Options > Export Workflow to accomplish this. We don't want to make wrong assumptions when providing solutions!

Labels