Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Alteryx is here to help you solve your biggest data challenges. Read about the new Virtual Solution Center here.
SOLVED

Truncate comma delimited string

Alteryx Partner

What is the best/cleanest way you know of to take a comma delimited string, such as "A,B,C,D,E,F,G", and return only the 1st  5 amount of items in the list? So the result would be "A,B,C,D,E". 

 

I don't want to split first and perform this operation to increase record volume. Please let me know if there is any another way to perform this operation.

Highlighted
Alteryx
Alteryx

I would probably just split the string and combine it unless you are dealing with extremely large data sets. My next choice would be using REGEX, which would probably be faster, but harder for many to understand. I'm no REGEX expert and I'm sure someone can come up with a more elegant example but the attached does what you want.

The pattern is just five instances of characters that don't include "," separated by commas:  "([^,]*,[^,]*,[^,]*,[^,]*,[^,]*).*" -> "$1"

Labels