cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle special characters when applying cross tab to transpose field value to field name

SOLVED
jeeva_ganesan
Asteroid
Hello all,

In my work, I am getting input data in key value format, which means one column having all the column names and the other ones having corresponding column values. Basically its a transposed version of the data. So I am applying Crosstab tool to get the data back to normal form. But the problem I am facing is - column names are having brackets, commas in it. For example, its like KILOS/LITRES('000). So when I apply transpose, column names are changed to this KILOS_LITRES___000_ . How to retain them in the original format?. 

I tried to use dynamic rename, but couldnt find a better logic to solve this as I have more than 40 columns in my data. 

Thanks in advance.
Alteryx
Alteryx

Hi,

Something like this should do what you need.  Not pretty, but gets the job done

rtaImage (4).png
So the summarise and RecordId tool create a lookup for each of your header fields names: 00001, 00002 etc...  The join tool replaces your original header field names with the new ones.  Which then go thorugh the cross tab without being changed.  Then the dynamic rename tool is in "Take field names from Right Input rows" mode which puts your original fieldnames back.

Module here

http://downloads.chaosreignswithin.com/community/KeepFieldNamesThroughCrossTab.yxmd

Cheers
Adam
 

Adam Riley
Principal Software Engineer
Tech Lead Core Engines
Alteryx
jeeva_ganesan
Asteroid
Hi Adam,

Thanks for your reply. It worked very well. :)

Regards,
Jeeva.