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

Alteryx Designer Desktop Discussions

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

Splitting column data to multiple rows (without using transpose)

Sakshi_M
7 - Meteor

Sample data:

 

Indexcol_aCol_battr_aattr_batte_c
1Name 1Details of 11,2,4a|c|d|e40
2Name 2Details of 23,5,6t|g|h20
3Name 3Details of 37,8f|b|h30
4Name 4Details of 49,10k|l15,12
5Name 5Details of 511h22
6Name 6Details of 622j42
7Name 7Details of 712,14j50,22

 

Resultant output:

 

Indexcol_aCol_battr_aattr_batte_c
1Name 1Details of 11a40
1Name 1Details of 11c40
1Name 1Details of 11d40
1Name 1Details of 11e40
1Name 1Details of 12a40
1Name 1Details of 12c40
1Name 1Details of 12d40
1Name 1Details of 12e40
1Name 1Details of 14a40
1Name 1Details of 14c40
1Name 1Details of 14d40
1Name 1Details of 14e40
2Name 2Details of 23t20
2Name 2Details of 23g20
2Name 2Details of 23h20
2Name 2Details of 25t20
2Name 2Details of 25g20
2Name 2Details of 25h20
2Name 2Details of 26t20
2Name 2Details of 26g20
2Name 2Details of 26h20
3Name 3Details of 37f30
3Name 3Details of 37b30
3Name 3Details of 37h30
3Name 3Details of 38f30
3Name 3Details of 38b30
3Name 3Details of 38h30
4Name 4Details of 49k15
4Name 4Details of 49k12
4Name 4Details of 49lh15
4Name 4Details of 49lh12
4Name 4Details of 410k15
4Name 4Details of 410k12
4Name 4Details of 410l15
4Name 4Details of 410l12
5Name 5Details of 511h22
6Name 6Details of 622j42
7Name 7Details of 712j50
7Name 7Details of 712j22
7Name 7Details of 714j50
7Name 7Details of 714j22

 

Usinmg three Text to columns tool one each for the attribute field. Is there is more optimum way?

6 REPLIES 6
ChrisTX
16 - Nebula
16 - Nebula

You could create a batch macro and pass in the 3 fields to use as the source for the Text To Columns tool (split to rows).  But if you only have 3 columns, your current method without a batch macro is probably the easiest.

 

Chris

Jay-RDC
8 - Asteroid

Hello. You can use Text to Columns tool to get the output you need. Please see attached screenshot. You can apply the same for the other columns. Just use the appropriate dlimeter.

binuacs
21 - Polaris

@Sakshi_M one way of doing this with the text tool column

 

binuacs_0-1659364812474.png

 

Sakshi_M
7 - Meteor

Thanks @ChrisTX Chris. Looking for a batch macro kind of solution.. but new to this so not sure how to build this.

Also the data I am working has 5 such field out of 33 fields. Would batch macro make sense here?

ChrisTX
16 - Nebula
16 - Nebula

@Sakshi_M see attached workflow and macro.

 

I avoided learning macros for a long time because they are definitely challenging.

 

Under Learn > Academy, try Learning Paths and Interactive Lessons and Videos.

 

The best advice I can offer for batch macros, which isn't stressed enough anywhere, is to feed your full data stream into the bottom input anchor, then feed your unique values (to define a batch) into the top input anchor.  In your main workflow click the icon for your macro and under the Group By tab, for the Control GroupBy Field drop-down, choose the field name that has your unique values (to define a batch). For the field Input GroupBy Field drop-down, leave that value as [None].

 

To debug a macro, open your macro then use menu option View > Interface Designer, then click the magic wand icon, populate any parameter values, then click the Open Debug window. A debug workflow will open as a new tab in your current Alteryx session. Run the debug workflow to make sure it is creating your desired results.

 

This also helps to debug:
Community > Blogs > Engine Works Blog > The X-Ray Browse: Macro Debugging Made Easier
https://community.alteryx.com/t5/Engine-Works-Blog/The-X-Ray-Browse-Macro-Debugging-Made-Easier/ba-p...

 

 

 

 

ChrisTX_0-1659441647105.png

 

ChrisTX_1-1659441697379.png

 

 

Chris

 

Sakshi_M
7 - Meteor

Thanks @ChrisTX This is very informative. ! (y)

Labels