Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Parse data into particular column

Yesha
6 - Meteoroid

Hi,

 

I am trying to parse data into particular column. 

Example: In column A  there are 3 values - date, province and name, theses needs to be moved to 3 respective column along with other data.

 

 Current Data Format 

Date/Province/NamePhone NumberCompanyCurrencyAmount  
6/20/2020      
Ontario      
XYX1324324dsCAD435  
FDS1324324dfUSD4543  
DKFS1324324dCAD243  
DFKJDG1324324vcxUSD2345  
FDGKJFD1324324cvxCAD654  
4/20/2020      
Quebec      
DKJ1324324sfCAD57  
DSJD1324324dsfCAD676  
JHVF1324324sdfCAD8  
KJFD1324324adCAD76  

 

Required Format

NameDateProvincePhone NumberCompanyCurrencyAmount
XYX6/20/2020Ontario1324324dsCAD435
FDS6/20/2020Ontario1324324dfUSD4543
DKFS6/20/2020Ontario1324324dCAD243
DFKJDG6/20/2020Ontario1324324vcxUSD2345
FDGKJFD6/20/2020Ontario1324324cvxCAD654
       
       
DKJ4/20/2020Quebec1324324sfCAD57
DSJD4/20/2020Quebec1324324dsfCAD676
JHVF4/20/2020Quebec1324324sdfCAD8
KJFD4/20/2020Quebec1324324adCAD76

 

I really appreciate any help. Thank you!

6 REPLIES 6
jacob_kahn
12 - Quasar

@Yesha  This is a great challenge! 

 

Please see my attached workflow!

Yesha
6 - Meteoroid

@jacob_kahn Thank you so much!! It is great to learn reg ex and multi row tool.

jacob_kahn
12 - Quasar

My pleasure! My favorite part of learning new things in different tools is being able to share the love and the knowledge and appreciation. Once you get into RegEx, you never go back....lol.

 

Sincerely and be safe,

 

J

Yesha
6 - Meteoroid

@jacob_kahn - Cna you please help to understand what this RegEx do:

(^\u\l.*)

 

I understood about separating date .

 

Thank you!

jacob_kahn
12 - Quasar

@Yesha 

 

Yes! I will explain, and please let me know if the thought process will mess you up.

 

I only saw three different types of options in the first data column: A Date, a City, and some value of Upper Case letters.

 

Therefore, in the formula tool, I took the 2 left characters and said that I know the city will first have an upper case character, and the second character should be lower case. If this is the scenario I know I'm dealing with a city and not a date or some value with just Capital characters. 

 

Therefore, basically the RegEx reads 

 

( - open the field you want to parse

^ - I'm starting at the beginning of the line

\u - confirm that the first character is upper case

\l - confirm that the second character is lower case

) - close the parsed line

 

The value -1 means that we are dealing with an upper case character followed by a lower case character, while the value 0 means that it is not the case.

 

Is that more clear for you?

 

Please like and accept if this answers your question and feel free to continue to ask away 🙂

 

J

jacob_kahn
12 - Quasar

As we discussed. Please see the second work stream.

Labels