Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Reading a string left to right

mattpwc
6 - Meteoroid

Hi,

 

I have a field titled "File Path Name" with values in the following format:

 

map/file/Delta Hospital

map/file/HSC/Alpha Hospital

screen/file/HSC/Omega Hospital

map/Sigma Hospital

 

I want to pull all characters (Hospital Names) to the right of the last "/" or essentially all characters from the end of the string up until the last "/". The problem is there are a different amount of "/" in every record, but the Hospital Name is always at the end of the string. Is there a way to read the string from right to left and find that first "/" and pull those characters?

 

Thank you for your help!

5 REPLIES 5
DavidP
17 - Castor
17 - Castor

This will do it

 

DavidP_0-1582154902338.png

 

fmvizcaino
17 - Castor
17 - Castor

Hi @mattpwc ,

 

I'm attaching an example where I use the regex tool to get that.

 

Take a look and let me know if this works for you.

Best,

Fernando Vizcaino

RolandSchubert
16 - Nebula
16 - Nebula

Hi @mattpwc ,

 

a solution doing literally what you've written, would be to use the function ReverseString, which reverses a string, FindString to find the last "/" (which is the first in the reversed string) and Right to pull the characters after the separator. As (nearly) always, there are different ways to solve a problem using Alteryx. Hope, this is helpful.

 

Best,

 

Roland

mattpwc
6 - Meteoroid

Works great thank you for the help!

mattpwc
6 - Meteoroid

Thank you!

Labels