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

How to loop through a single string value to create new output

lnkh
6 - Meteoroid

I have a comment column that can contain 0 or more comments within the single field. The comments within one record are pipe delimited. Each comment follows a structure of "date (name) - comment". I need to figure out which comments are valid depending on whether the name contains "ADMIN" and then display the comment text only along with the pipe deliminater. I cant figure out how to accomplish this in Aleryx. I've thought of iterative macros and regular expressions but cant come up with a clean solution. Below is an example of input and expected output. Is this possible?

 

inputoutput
05/16/2018 12:33 PM EDT -(USER) Canceled. |10/26/2018 07:28 PM EDT - (LOCPADMIN) this is an admin comment1 |10/27/2018 07:28 PM EDT - (LOCPADMIN) this is an admin comment2 |10/30/2018 07:28 PM EDT - (LBDADMIN) This is an admin comment3|this is an admin comment1 | this is an admin comment2 | This is an admin comment3|
04/25/2018 12:06 PM EDT - (BOBB) Alphabet soup is delicious| 
10/26/2018 07:30 PM EDT - (LOCPADMIN) Alteryx is great|Alteryx is great|
7 REPLIES 7
neilgallen
12 - Quasar

@lnkh Can't say this would work for all your situations, but based on your example seems to be okay. There may be a more direct route but I'm not sure what it would be. You can use the regex tool in tokenize mode in order to get the multiple comments in the same string.

 

workflow.PNGregex.PNG

 

EW
11 - Bolide

This might not be the most elegant solution, but I believe you can get it done by splitting to rows, Regex parse, and re-concatenating the relevant comments.

 

admincomments.PNG

lnkh
6 - Meteoroid

Thanks Neilgallen. I tried your suggestion but it stops parsing the comments once it finds the first match. So I cannot get the output desired for the first record.

This example still taught me something new. I appreciate your help!

lnkh
6 - Meteoroid

HI EW,

 

Your solution works!!! But when I concatenate the results, they are concatenated with a ',' separating each record instead of |

 

When I plug my file into your workflow it works but when I try to recreate from scratch I get commas.

 

What am I missing? Which part of the workflow configures this?

 

Thank you so much!

TonyA
Alteryx Alumni (Retired)

You can set the separator at the bottom of the configuration window for the summary tool.

 

2019-03-27_14-44-58.jpg

lnkh
6 - Meteoroid

My mistake Neilgallen. YOur solution works too.

 

Im still trying to figure out that regular expression  though =) . thanks so much!

lnkh
6 - Meteoroid

O thanks!!

 

This is the best forum I've every seen. thank you everyone for your help.

Labels