Alteryx Designer Desktop Discussions

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

- Underscores After - Cross Tab

suby
11 - Bolide

Hi All,

 

I have searched the community already and there where more solutions but looking for a solution on my specific requirement

 

I'm doing the crosstab tool function within a macro and then outputting the data from my macro to overwrite the input file.

 

The input columns looks like these.. 

Customer Name - Contact

Customer Name Contact: Contact-Address

Customer - Age

 

But After crosstab 

 

 Customer_Name_Contact

 Custome_Name_Contact_Contact_Address.

 Customer_Age

 

I'm looking for a solution where i don't want to rename the columns using the select tool since i have a huge list of Columns rather a dynamic way so that the name matches exactly the same as Input Data Columns.

 

Thanks

6 REPLIES 6
IraWatt
17 - Castor
17 - Castor

Hey @suby,

You can use the dynamic rename, select all columns and use this rename formula:

IraWatt_1-1656924408629.png

 

messi007
15 - Aurora
15 - Aurora

@suby,

 

You can use a dynamic rename and replace function.

 

messi007_0-1656924411104.png

 

Attached the workflow,

Regards

suby
11 - Bolide

Hi,

 

Thanks for the solution but when i have column header like this 

 

Customer Name Contact: Contact-Address  

 

if i use the replace function I loose this semicolon and a hyphen as well any thoughts how to fix this..

 

suby_0-1656926756724.png

 

IraWatt
17 - Castor
17 - Castor

I had a try with Customer Name Contact: Contact-Address and it didnt remove the semicolon and a hyphen. You could untick that column from the top if your having issues. Or we could make the formula more complex.

IraWatt_0-1656926935738.png

 

DataNath
17 - Castor

How does this look @suby? Instead of hard-coding replacements, this may be a little more dynamic. The underscores basically come from Alteryx replacing 'special characters' like spaces and punctuation with _ when Cross-tabbing. One of the options of the Dynamic rename tool is that we can provide a header to look for and what to replace it with. Therefore, this Formula tool off-shoot basically replaces anything that isn't a word in the original header with _ and so should create a copy of what the Crosstab tool will output, meaning we can just use that as a reference to find and replace it with the original header:

 

EDIT: Forgot to mention. This also means that if there does happen to be underscores in your desired headers, these 'innocent' underscores won't be removed.

 

DataNath_0-1656927405183.pngDataNath_1-1656927413933.pngDataNath_2-1656927424500.png

binuacs
20 - Arcturus

@suby one way of dong this by only taking the column names then using dynamic rename tool replace the cross tab columns, this way you can keep the original column names

binuacs_0-1656927601954.png

 

Labels