Early bird tickets for Inspire 2023 are now available! Discounted pricing closes on January 31st. Save your spot!

Alteryx Designer Discussions

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

Transform the headers to The required Format

DataPirate26
9 - Comet

Hi,

 

I want to transform my Headers Input to the Desired Header format. 

 

Basically need to replace the "_" from the headers except for few of them which has the same header name only a no 2 is added after it with "_". 

 

example : Turlock 0621_2. Apart from this types rest all "_" needs to be removed. The sample Data with headers are attached below. Can someone help me out in this. 

6 REPLIES 6
gautiergodard
12 - Quasar

hello @DataPirate26 

See solution attached!

DataPirate26
9 - Comet

@gautiergodard You missed out one point which I mentioned. That there are few exceptions in which I need the underscores. Example Turlock 0621_2. There are 3 4 cases in which a no 2 is added at the last. In those cases I need to keep the underscores. Can you check the desired headers Sample once. 

DataPirate26
9 - Comet

@gautiergodard When the Headers are exact same but only at last the No 2 is added in that case i need to keep the underscore before the number 2. Apart from that all underscores to be removed

gautiergodard
12 - Quasar

@DataPirate26 here you go!

DataPirate26
9 - Comet

@gautiergodard This worked perfectly fine. Thanx a lot for your quick response. 

binuacs
17 - Castor

@DataPirate26 One way of doing this 

IIF(EndsWith([_CurrentField_], '_2'),Replace(REGEX_Replace([_CurrentField_], '(.*)(_.*)', '$1'),'_','-')+'_2',Replace([_CurrentField_],'_','-'))

binuacs_0-1666332575984.png

 

Labels