Free Trial

Alteryx Designer Desktop Discussions

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

IF CONT. REPLACE - If a portion of the string before comma has no space, then repeat it

erinylai
7 - Meteor

Hi everyone, I would love so help with an expression. I have attached a spreadsheet which outlines the input, desired output, and an approach I am considering. Here is a summary of the issue (which is the same as what is in Excel too) 

 

erinylai_0-1674931266454.png

 

One approach I am thinking of is: 

After applying the "+" delimiter to parse out the data to the following, add a formula to the data such that, if there is no space before the comma, the original string (e.g., "TCL") repeats itself with a space in between (following the same example, it becomes "TCL TCL").

 

erinylai_1-1674931324874.png

 

If anyone could please provide some pointers with the expression I would really appreciate it. If you have another easier approach, I would love to hear it too. Thank you so much!! 

8 REPLIES 8
binuacs
21 - Polaris

@erinylai One way of doing this, not the prettiest side, did lots of Regex to re-arrange the input string to make the parse easy

 

binuacs_0-1674942674181.png

 

erinylai
7 - Meteor

Hi binuacs, really appreciate your response (again!!!) I uploaded some of the real data and tried out your flow, but it seems like the output is a bit different. Could you please help me take a look and see if I did anything wrong? I have attached the workflow and the related excel workbook. Thanks so much for your help! 😊

binuacs
21 - Polaris

@erinylai since the pattern is different i need to rearrange the regex, do you have the expected output for your input file?

erinylai
7 - Meteor

Yes! There is a "Desired Output" tab in the Excel file I attached in the last response and it's as follows. Really appreciate your help!

 

erinylai_0-1675005410551.png

 

binuacs
21 - Polaris

@erinylai updated workflow attached

 

binuacs_0-1675030898882.png

 

erinylai
7 - Meteor

Than you so much binuacs! Form some reason it seems that in the final result, one instance of the number did not get turned into a range. (i.e., "4"  in the last row ---> JEWRT GG356_177 4). Do you by chance know why that might happen? 

 

Thank you so much again for helping me. 

 

erinylai_0-1675033222138.png

 

erinylai
7 - Meteor

Actually I figured it out so you could ignore the previous question! Thank you so much for your help. 😊

binuacs
21 - Polaris

@erinylai I am glad that the solution worked for you. It was a challenging one 😁

Labels
Top Solution Authors