Alteryx Designer Discussions

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

General Discussions has some can't miss conversations going on right now! From conversations about automation to sharing your favorite Alteryx memes, there's something for everyone. Make it part of your community routine!

SOLVED

Rename columns before moving them to Dynamin Input tool

JitenderChawla
8 - Asteroid

I am creating an Alteryx workflow that has the directory tool and then the Dynamic input tool to pull all xlsx files from the specified path.
However, The last 2 columns in each file have a different name. There are 12 files in all and the last column name changes from Jan 2020 XXXXX to Dec 2020 XXXXX.
The dynamic input tool works fine and unions all the 12 files however throws multiple Warning messages.

Is there a way I could change the columns names (for the last 2 columns) before they are being dealt by the Dynamic Input tool.

wdavis
Alteryx
Alteryx

Hi @JitenderChawla 

 

The best way to do this will be to use a Batch Macro. This will allow you to process all 12 of your files and to update the specific name.

 

Have you used Macro's previously? If not, the link here, goes into detail of how to save and install Macros - https://community.alteryx.com/t5/Alteryx-Designer/Macro-Installation/ta-p/13032

 

Then I have attached a Macro example which should work in your example. Your workflow will look similar to as it does now, but instead of the Dynamic Input, you will use the new Macro.

 

Within the Macro, you firstly need to enter a template file (1 of the 12 files), the next step is using a Dynamic Rename to update specific fields based on a Formula. I have used an IF statement which looks if a Field Name contains a certain string, in your case this would be the 'XXXXX'. It will then produce an output with all files stacked on top of each other.

 

I have also included a guide with more detail on getting started with Batch Macros here - https://community.alteryx.com/t5/Alteryx-Designer/Getting-Started-with-Batch-Macros/ta-p/488165

 

Let me know if this works for you, or if you have any questions.

 

Kind Regards

Will

 

 

 

JitenderChawla
8 - Asteroid

@wdavis , Thanks for your response.

 

Hopefully this should work.

 

However there is another issue-:

I want the file path to be dynamin so that we don't have to change it year after year. The file path looks something like -

\\ffnp08\TAX\S A\D F\PAY\2019\Input\Home

next year when I am using the workflow I will be accessing 2020 folder and so on.

 

In my current workflow I am using the formula tool to calculate the previous year and then use it to alter the Pull path from the directory tool.

 

How can I incorporate this in the macro.

 

Regards,

Jitender 

 

Labels