Hello,
I'm pretty new to Alteryx and am trying to process a dataset that includes a concatenated string column comprised of user-entered items and quantities. I suspect RegEx would be the way to handle this, but don't have enough experience with it and was hoping someone could help out. I have attached a very simplified example of what the incoming data would look like and the desired output.
Basically I want to parse the input data for the items in the list and store the quantity of each item in a separate column, with the remaining string in a separate column.
Any help would be greatly appreciated!
Thank you 🙂
In the example attached:
Input data:
Input |
1BANANAAPPLE 2ORANGES1GRAPES 1PEAR |
1APPLESPEARS 2BANANA ORANGE |
1GRAPE1ORANGES PEAR1APPLESPEARS |
Item list:
Items of Interest |
Apple |
Banana |
Grape |
Desired output:
Input | Apple | Banana | Grape | Other |
1BANANAAPPLE 2ORANGES1GRAPES 1PEAR | 1 | 1 | 1 | 2ORANGES1PEAR |
1APPLESPEARS 2BANANA ORANGE | 1 | 2 | PEARSORANGE | |
1GRAPE1ORANGES PEAR1APPLESPEARS | 1 | 1 | 1ORANGESPEARPEARS |
Solved! Go to Solution.
Hi @Ross_K, I was able to process your data and get it to a point where you are able to view the Items of Interest in a tabular format. As for those that don't, I'll get back to you once I spend more time with it. Hope this helps.
Hi @Ross_K ,
I'm attaching a solution where I'm using the regex tool to separate all appearances of the 3 fruits and also a regex_replace function to build your 'others' column.
Best,
Fernando Vizcaino
@Ross_K - attached is my updated solution. I confess using @fmvizcaino's approach for the Other's path. His regex piece was my missing link.
Thank-you both @fmvizcaino and @AbhilashR for the prompt replies and accurate solutions. I decided to go with that of @fmvizcaino given the elegance and minimal steps of the solution, but both achieve the result very well.
Thanks 🙂
User | Count |
---|---|
17 | |
15 | |
15 | |
8 | |
5 |