In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

Need to substring cell with embedded newline characters

jenniecobb
5 - Atom

I have a spreadsheet that has a field with embedded newline characters.  I really just need to keep the first line of this 'multi-line' field.  I've tried doing a find and then substring on the field, but it's not truncating after the first line.  I tried the following asubstrnd several similar options, but the field is not getting substringed:  Substring([AddressField],1,FindString{[AddressField],"\n")-1) but this is still returning the full field in the output file.  Is there a correct way to truncate the field?

 

Example of the data:

Address Line 1

Address Line 2

City, ST, Zip

 

I only need to keep the first line in this case, as there are other fields with the same data.  Thanks.

 

3 REPLIES 3
GavinAttard
11 - Bolide

Hi 

 

Can you upload an example of the data?

 

kr

Alteryx Everything, Leave no one behind.
MarqueeCrew
20 - Arcturus
20 - Arcturus
Regex_replace([field],"(.*?)\n.*","$1")

Might do the trick

Sent from my iPhone
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
jenniecobb
5 - Atom

Thanks, this did the trick!

Labels
Top Solution Authors