Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Create new columns in front of columns with certain prefix

Mtvbqb
7 - Meteor

Hello,

 

I have a data set where the number of fields will shift dynamically. I need to place an empty column in front of columns that contain one of two prefixes.

 

Example:

 

NameIDABC_923ABC_928TotalXYZ_876XYZ_572
       
       

 

Would be transformed into this:

 

NameIDABC_923_2ABC_923ABC_928_2ABC_928TotalXYZ_876_2XYZ_876XYZ_572_2XYZ_572

 

 

Any help would be hugely appreciated. Thanks!

6 REPLIES 6
AbhilashR
15 - Aurora
15 - Aurora

@Mtvbqb - does the attached solution work as an acceptable solution in your case?

Greg_Murray
12 - Quasar

@Mtvbqb 

 

This was a little tricky. I am sure there are better solutions out there, but this worked for me. 

 

see attached.

 

-Greg

AbhilashR
15 - Aurora
15 - Aurora

@Greg_Murray - I love the way you managed to programatically get your column order intact. Definitely using this approach in my day-to-day work!

Greg_Murray
12 - Quasar

@AbhilashR Thanks! I had to ponder on it for a bit.

Mtvbqb
7 - Meteor

Thanks for the solution! This is exactly what I struggled all morning to achieve!

 

Keeping the column order was vital, so thanks again for that!

grossal
15 - Aurora
15 - Aurora

I know I am a bit late, but I want to post my result anyway 😉

 

grossal_0-1585335520633.png

 

I came up with a similar approach to @Greg_Murray but was able to save some tools.

 

Workflow is attached.

 

 

Alex

 

 

Labels
Top Solution Authors