In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Make sure to check your account preferences in my.alteryx to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Truncate comma delimited string

neeleshapatil1
8 - Asteroid

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.

1 REPLY 1
TonyA
Alteryx Alumni (Retired)

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
Top Solution Authors