Alteryx Designer Desktop Discussions

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

How to discard the last few words from concatenated string

Rohan2020
7 - Meteor

I looking for solution to discard the last three words from concatenated string. The string length is dynamic and gets generated based on excel file input. 

 

For Eg.

abc|def|acd|cf78c|bn12mn

 

Exclude -acd|cf78c|bn12mn from above string

5 REPLIES 5
mbarone
16 - Nebula
16 - Nebula

Are the words always going to be separated by pipes so that essentially you need to remove everything from the third-to-last-pipe on?

messi007
15 - Aurora
15 - Aurora

@Rohan2020,

 

please see below:

 

messi007_0-1608822279028.png

Attached the workflow,

 

Regards,

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Rohan2020,

 

If you use a Text to Columns and set the delimiter to PIPE, you can set the # of output columns to 2 and discard the remaining contents.  Alternatively..

 

REGEX_Replace([Field1], "(.+)\|.+\|.+\|.+", '$1')

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Rohan2020
7 - Meteor

Yes the string is always separated with pipe | and it should exclude the last three words and return remining string.

 

 

Exclude -acd|cf78c|bn12mn

 

 

messi007
15 - Aurora
15 - Aurora

@Rohan2020 

 

Have you tried my solution or @MarqueeCrew solution's?


If this solves your issue please mark the answer as correct, it will help others!

 

Regards,

Labels
Top Solution Authors