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

Automate Column name with File name

areeba
8 - Asteroid

Hi @atcodedog05 

 

I have a requirement where my column name has to be update with file name .

 

for example :

 

I have 2 files with the name:

1) 2021Finalreport07

2)Monthly 12-2020

 

From each file I need to create a column , where column name picks up the year from the file name.

 

column name should be like of file1: Budget Year 2021

column name should be like of file2: Budget Year 2020

 

Idea is to automate the column names every year as per the filename year.

 

Can you give suggestions?

 

Regards

Areeba

 

 

26 REPLIES 26
joslynzichawo
Alteryx Alumni (Retired)

Hey @areeba, are you looking to set up a dynamic solution or to just create the new file name for these 2 instances?

areeba
8 - Asteroid

Hi @joslynzichawo 

 

The idea is to make sure that next year the number of the year is going to be updated in the column name

Column(Budget Year) with the Filename year (2020). column name should display as Budget Year 2020. This should automate every year when the filename year changes.

For ex: for next year it should be Budget Year 2021

 

Can you help?

joslynzichawo
Alteryx Alumni (Retired)

Hi, I have two solutions here for you:

 1. Use regex to pull out the year 

 

2. Use our date time tool to pull the current year

 

Hope this helps

areeba
8 - Asteroid

Hi @joslynzichawo ,

 

Thank you for the reply but this is not what i am looking for.

i want to add this year after my column name dynamically.

DawnDuong
13 - Pulsar
13 - Pulsar

hi @areeba 

You can do this via 2 steps:

1) Select the option "Output file name as file". >> This auto generates a new column called "File Name" which, can be either just the file name (e.g. 2021Finalreport07)

2) Use the formula tool to extract the relevant part of the file name that indicates the year and concatenate with whatever additional text you need in the new column value.

 

Note that this will work ONLY IF there are clear pattern in your file names. If there is no pattern in the file name e.g. your file name is "twoThousandN1" it's very challenging for the computer to recognise it as "2001".

Hope this helps.

Dawn.

areeba
8 - Asteroid

Hi @DawnDuong ,

 

I agree with your second solution,i used the formula tool to extract relevant part. Now i am getting stuck at how to connect or concatenate with the column name not its values.

 

can you give an example how to do that?

 

Regards

Areeba

 

 

DawnDuong
13 - Pulsar
13 - Pulsar

hi @areeba 

Actually what I suggested is a 2-step process. You need to do both, not just 1 or 2. 

Back to the question at hand, if you have already managed to extract, say "2017" from the File name and that value is stored in column [Year].

Now you want a new column call "My year is 2017"

You can add a new column (using Formula Tool) and type the following in the formula editor:

"My year is " + [Year]

If you are new to Alteryx, i suggest that you check out the Learning Path (https://community.alteryx.com/t5/Learning-Paths/tkb-p/learning-path) or Interactive Lessons (https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons).

I personally found the Interactive lessons highly effective. Each is only a few minutes long and you get a solid grounding in the basics. The foundation/basics are must-have before you can attempt to solve real problem.
Dawn.

areeba
8 - Asteroid

Hi @DawnDuong 

 

Thank you for the reply but this solution i working for the rows not the column name

 

Regards

Areeba

Peachyco
11 - Bolide

@areeba : You might need the Dynamic Rename tool, like in this sample workflow:

Labels