Alteryx Designer Desktop Discussions

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

How to parse 2 columns at same time? How to deal with delimeters with nothing inbetween?

lynnlinnewtoalteryx
6 - Meteoroid

My question looks a bit complex, and I'll try to make it clear what I want to achieve. I have a dataset like this:

 

RecordIDRouteClassType
1HKG-LHR,GLA-LHR,LHR-HKGBusiness/Economy/Business
2HKG-DLC,DLC-TNA,TNA-HKGEconomy/Economy/
3HKG-JFK,JFK-MCO,MCO-JFK,JFK-HKGEconomy///Economy

 

For analyse purpose, I want to parse column 'Route' and 'ClassType' so that each route and type forms one row. However, if I simply parse by 'Text to Columns' into rows, it became uneven, with more rows parsed by 'Route' and less rows parsed by 'ClassType' hence I cannot re-join them by position. The reason I've seen is that there was '//' or ending '/' in 'ClassType' which was skipped and not parsed into a new row. For example, the first 2 rows of my data hence became like below:

 

RecordIDRouteRecordIDClassType
1HKG-LHR1Business
1GLA-LHR1Economy
1LHR-HKG1Business
2HKG-DLC2Economy
2DLC-TNA2Economy
2TNA-HKG3Economy

 

What could I do to solve this problem? I thought maybe I could use some other tools, like Regex, but don't know how to translate the pattern...

Thank you in advance for those who could help provide solution(s)!

 

Kind regards,

Lynn

5 REPLIES 5
Qiu
20 - Arcturus
20 - Arcturus

@lynnlinnewtoalteryx 
Hope this would help. 😁

1118-lynnlinnewtoalteryx.PNG

Pingu
10 - Fireball

I thought it was a interesting problem. I interpreted it a bit different than Qiu, as the classtype for TNA-HKG is unknown as far as I can see and not economy.

 

Pingu_0-1637222340764.png

 

lynnlinnewtoalteryx
6 - Meteoroid

Thank you! You're right, there should be 'unknown' ClassType inbetween 2 back-to-back '/' or end with a '/'.

lynnlinnewtoalteryx
6 - Meteoroid

Thank you! Though I'd expect another row of RecordID #2 with an unknown ClassType. It helps as well!

Christina_H
14 - Magnetar

I think this should do it.

Christina_H_0-1637229445526.png

 

Labels