Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Text to columns with specific no. of words in phrase

psoma
6 - Meteoroid

Hi,

 

I wish to turn below input data to the CSV/tab delimited form as mentioned under output. Issue is that Campaign name is not fixed size(words).

 

<input data>

Marketing Campaign Name

Email List Subscribers Jan 2020

Beauty Customers Feb 2020

Spring Sale March 2020

Product Category Campaign April 2020

Loyal Customer Campaign May 2020

Summer Sunshine June 2020

 

<output data>

 

Marketing Campaign Title

Month

Year

Email List Subscribers

Jan

2020

Beauty Customers

Feb

2020

Spring Sale

March

2020

Product Category Campaign

April

2020

Loyal Customer Campaign

May

2020

Summer Sunshine

June

2020

 

 

I think i can achieve it by using looping condition.. something like below:

 

month = campaign's last second word

year = campaign's last word

For(words in Campaign; words < campaign's last second word; next word)

     Marketing _campaign_title = campaign title + words

 

 

I wish i have something like "Multi-Row-Formula" which can access words in a phrase of the current record and append them so that in the following hops text can me converted to columns.

 

Thanks..

P.s, I love the Alteryx community.. amazing responses and well structured.. great learning.

4 REPLIES 4
kelsey_kincaid
12 - Quasar

Hi @psoma ,

Would the below work for your needs? It's a Regex tool with a formula that parses the Marketing Campaign field. Let me know what you think!

 

kayers_0-1591052410007.png

 

P.S. I'm new to using Regex, so it's possible there's a way to write this statement more elegantly!

PhilipMannering
16 - Nebula
16 - Nebula

This is the shortest I can make the regular expression (using the Regex tool set to Parse),

 

(.*) (\w+) (\d+)

 

But @kelsey_kincaid method works just as well. 

T_Willins
14 - Magnetar
14 - Magnetar

Hi @psoma,

 

@kelsey_kincaid posted just faster than me.  I had the same solution using the more generic formula in RegEx of   (.*)\s(.*?)\s(.*)  with the same results.  I agree RegEx is the best approach.

psoma
6 - Meteoroid

Thanks for the quick responses. RegEx works like charm.

P.s I was consumed by loop option.

Labels