Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Splitting data evenly into 3 columns

TP-90
5 - Atom

Hello,

 

I am new to Alteryx and I am trying to split the data evenly into 3 columns but couldn't able to find a workaround to achieve this problem.

 

For Example: In my workflow, I am getting below output, which is not splitting correctly.

 

My Output Result
PBSPBS
123-456789-AA123456789AA
555-6666-DDD5556666DDD
LM5555-AAALM5555AAA 
CM666-BBBCM666BBB 
JHS55-CCCJHS55CCC 

 

Below is the corrected output:

 

Correct Output Result
PBSPBS
123-456789-AA123456789AA
555-6666-DDD5556666DDD
LM5555-AAA LM5555AAA
CM666-BBB CM666BBB
JHS55-CCC JHS55CCC

 

Thank you so much.

6 REPLIES 6
afv2688
16 - Nebula
16 - Nebula

Hello @TP-90 ,

 

Use the following regular expression on the regex tool:

 

(\d{3})?-?(.*)-(.*)

 

set the output method on parse.

 

Cheers

TP-90
5 - Atom

Hello afv2688,

 

I used your regular expression but the output result is still not correct.

 

Please see below:

 

Output Using Regular Expression on the Regex
P-B-SRegExOut1RegExOut2RegExOut3
123-9999-AA 123-9999AA
789-8888-BB 789-8888BB
S478965-Q789 S478965Q789
R9999-S4579 R9999S4579
T78919-R5248 T78919R5248

 

Correct Output
P-B-SRegExOut1RegExOut2RegExOut3
123-9999-AA1239999AA
789-8888-BB7898888BB
S478965-Q789 S478965Q789
R9999-S4579 R9999S4579
T78919-R5248 T78919R5248

 

 

Thank you so much, I appreciate your help.

 

danilang
19 - Altair
19 - Altair

Hi @TP-90 

 

My knowledge of Regex isn't quite up to the point of doing this one statement, but by adding a formula tool to artificially add a initial hyphen if it's missing, then a Regex parse on Hyphen will split and correctly align your data

 

WF.png

 

 

Results.png

 

Maybe @Thableaus can respond with a single Regex solution

 

Dan

afv2688
16 - Nebula
16 - Nebula

Hello @TP-90 ,

 

I copy pasted the solution I posted earlier and it is working for me:

 

Untitled.png

 

I don't know why it is not working for you. Anyways, you can still use @danilang solution. It may solve your problem :)

 

Cheers

TP-90
5 - Atom

Hello Danilang,

 

Thank you so much for helping. 

Appreciate your help.

TP-90
5 - Atom

Hello Afv2688,

 

Thank you so much for your help, some how it was throwing out wrong results.

 

Appreciate your help!

 

 

Labels
Top Solution Authors