Alteryx Designer Desktop Discussions

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

Changing Header Name Dynamically using table header input

SH_94
11 - Bolide

Hi Community

 

I had read few post regarding how to change the header name dynamically but i have few criteria which i didn't see in other post.

 

In my original source file , there are various of header (more than 30) and below is the dummy header name for the reference.

SH_94_0-1621678242319.png

I plan to rename them accordingly and i have prepare the summary of table on the header name as below:

SH_94_1-1621678314289.png

There are two things which i would like to seek for assistance.

1. May i know how to generate out all the header name in the format above (after consolidating all the file)  as i want to prepare the table name (desired name) as per screenshot above

2. After preparing the table name, May i know how can i build the workflow to change the header name dynamically based on the table name that i required?

 

9 REPLIES 9
mceleavey
17 - Castor
17 - Castor

Hi @SH_94 ,

 

I've read this a number of times and I still don't understand what you're trying to do.

 

The data doesn't make much sense. Are you saying that row 1, 6 and 11 are header rows? What logic are you using to output the new headers? Are you wanting to dynamically create the second table?

 

I don't understand.

 

M.



Bulien

atcodedog05
22 - Nova
22 - Nova

Hi @SH_94 

 


@SH_94 wrote:

There are two things which i would like to seek for assistance.

1. May i know how to generate out all the header name in the format above (after consolidating all the file)  as i want to prepare the table name (desired name) as per screenshot above

2. After preparing the table name, May i know how can i build the workflow to change the header name dynamically based on the table name that i required?

 


Based on your questions

 

1. You want get a list of existing header names and do some data manipulation to get to desired header.

How you can do that is use a field info tool to get field names, union them all together to get a consolidate list, use data data cleanse tool to remove punctuations and leading/trailing spaces. Then i am using a formula tool to generate desired headers.

The logic i could understand is

 

IF [Desired Headers] in ("Total amount after the year","Total amount in the year") THEN [Desired Headers] 
ELSEIF [Desired Headers]="Total amount" THEN "SH-Total number"
ELSE "SH-"+[Desired Headers] ENDIF

 

 

Refer the below workflow where i am doing the same. You can change the logic based on your requirement.

 

atcodedog05_0-1621679773056.png

 

 2. You want to rename the older headers with new headers.

Using dynamic rename tool I am configuring it to look for old header names and replace with new headers name from the created summarize table. Using take field names right input rows config. Refer the below workflow.

atcodedog05_2-1621680077730.png

 

Hope this helps 🙂

danilang
19 - Altair
19 - Altair

hi @SH_94  

 

Good solution from @atcodedog05, here.  The only suggestion that I would make is to take the matching logic out of the formula tool.  Having it hardcoded makes the workflow difficult to maintain.  Instead of this, add your header mapping table as an input,  either .csv or .xlsx and use a Join or Find Replace on Original Header Name.  This way if the you need to add more mappings, you just add a new line in the mapping table

 

Dan 

SH_94
11 - Bolide

Hi @mceleavey ,

 

Sorry for the confusion caused.

 

The header name will be row 2, 7,and 12. I plan to use dynamic rename tool to rename it but i plan to use the header name that i want for the output result as below.

 

For the second table, i plan to rename it in the local desktop and upload into the alteryx and ask the alteryx to change the header name accordingly.

SH_94_0-1621681928371.png

 

SH_94
11 - Bolide

Hi @danilang ,

 

Yes. This is exactly what i plan to do by input the table header mapping and use find and replace to change the header name accordingly.

 

Do you have the solution for this ?

 

SH_94
11 - Bolide

Hi @atcodedog05 ,

 

Thank you for your prompt response. As i would like to control the header name mapping table , i plan to do it in the local desktop and input it in the alteryx and use the dynamic rename to replace the header name accordingly.

 

 

Currently, i am using batch macro to input all the data file and all already in the consolidated version. Could you guide me how to use the above method (input the table name from local desktop) and change it in the alteryx ( replace the older header name with new header name).

 

 

Thank you.

atcodedog05
22 - Nova
22 - Nova

Hi @SH_94 


I have modified the workflow to cater for the requirement. You can directly feed your old header-desired header data into R anchor of dynamic rename field and set config as below. This works like a find & replace on exact match.

 

atcodedog05_0-1621682681946.png

 

Hope this helps 🙂

 

SH_94
11 - Bolide

Hi @atcodedog05 ,

 

Thanks a lot for the prompt response .It is exactly what am i looking for and it solve for the question 2.

 

However, for question 1, i not sure how to do it. Basically what i plan to do for question 1 is : i plan to render out all the header name (after consolidating all the file)  as per screenshot below : change the header name from horizontal to vertical and then i amend the file in the local copy (change the header name) before i input the table mapping name in the alteryx

SH_94_0-1621683582277.png

 

Could you please advise on how can i do that?

 

 

 

atcodedog05
22 - Nova
22 - Nova

Hi @SH_94 

 

For getting a consolidated list of Field names you can use a filed info tool which gives info on fields in data. Later i am unioning header names from all the sources & using summarize tool groupby field name so that i get only distinct field names.

atcodedog05_0-1621684409224.png

 

Hope this helps 🙂

 

Labels