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

Parse string with one or multiple delimiters using RegEx

LEXQ2005
8 - Asteroid

Table 1 Input is the initial data:

    

Order IDOrder QtyStatus IDStatusScenario
OR_0000011473717;Delivered;Order Qty = # of Status (Normal)
OR_00000210494086;94089;494090;494099;494100;494101;494102;494103;494104;494105Delivery Started;;Delivered;Delivered;Delivery Started;Delivered;Delivery Started;Delivery Started;Delivery Started;Delivered;one order with blank status
OR_0000037496038;517460;530925;Delivered;Delivered;Cancelled;Order Qty > # of Status

 

Table 2 Output is the desired Alteryx output:

    

Order IDOrder QtyStatusIDStatus
OR_0000011473717Delivered
OR_00000210494086Delivery Started
OR_0000021094089 
OR_00000210494090Delivered
OR_00000210494099Delivered
OR_00000210494100Delivery Started
OR_00000210494101Delivered
OR_00000210494102Delivery Started
OR_00000210494103Delivery Started
OR_00000210494104Delivery Started
OR_00000210494105Delivered
OR_0000037496038Delivered
OR_0000037517460Delivered
OR_0000037530925Cancelled

 

How can I use RegEx to parse the StatusID and Status in table 1 by semicolon to generate table 2?

The sample data file is attached. Thanks. 

5 REPLIES 5
atcodedog05
22 - Nova
22 - Nova

Hi @LEXQ2005 

 

Here is a workflow for the task.

Output:

atcodedog05_0-1606996868229.png

Workflow:

atcodedog05_1-1606996891627.png

Text to column split to rows on delimiter ;

Need to handle status ID and status separately

Tile tool give sub ids based on OrderID Order Qty

Join them together

 

Hope this helps 🙂 Feel to ask if you have any questions


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

LEXQ2005
8 - Asteroid

It's a great solution. Thanks! @ atcodedog05

 

I know RegEx is mighty, I'm still interested in hearing about a RegEx solution for this problem. 

atcodedog05
22 - Nova
22 - Nova

Hi @LEXQ2005 

 

Regex is really mighty when it comes to splitting text to multiple columns.

 

Splitting to row best possible alternative using regex tool would be tokenize split to rows. Which would be similar to this.

 

Happy to help 🙂

 

Cheers and Happy Analyzing 😀

 

Feel free to reach out if you face any issues 🙂

LEXQ2005
8 - Asteroid

Thanks! 

 

Is that possible to break down to rows by the number of Order Qty for each Order?

The data input is:

Order IDOrder QtyStatus IDStatusScenario
OR_0000011473717;Delivered;Order Qty = # of Status (Normal)
OR_00000210494086;94089;494090;494099;494100;494101;494102;494103;494104;494105Delivery Started;;Delivered;Delivered;Delivery Started;Delivered;Delivery Started;Delivery Started;Delivery Started;Delivered;one order with blank status
OR_0000037496038;517460;530925;Delivered;Delivered;Cancelled;Order Qty > # of Status
OR_0000042  the whole order not yet has a status mark

 

The desired Alteryx output is:

Order IDTotal Order QtyOrder QtyStatusIDStatus
OR_00000111473717Delivered
OR_000002101494086Delivery Started
OR_00000210194089 
OR_000002101494090Delivered
OR_000002101494099Delivered
OR_000002101494100Delivery Started
OR_000002101494101Delivered
OR_000002101494102Delivery Started
OR_000002101494103Delivery Started
OR_000002101494104Delivery Started
OR_000002101494105Delivered
OR_00000371496038Delivered
OR_00000371517460Delivered
OR_00000371530925Cancelled
OR_00000371  
OR_00000371  
OR_00000371  
OR_00000371  
OR_00000421  
OR_00000421  

 

The sample data file is attached. 

 

atcodedog05
22 - Nova
22 - Nova

Hi @LEXQ2005 

 

Here is a workflow for the task.

Output:

atcodedog05_0-1607019343961.png

Workflow:

atcodedog05_1-1607019369949.png

 

Hope this helps 🙂 Feel to ask if you have any questions


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

Labels