Alteryx Designer Desktop Discussions

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

Insert a carriage return for a new line within the same cell

wendy_lu
6 - Meteoroid
Hi, Alteryx expect,

I have a need to insert two carriage return for a long string into new lines when seeing  special characters, for example my current string is:"index1 is 10 and index2 is 20"
that I want to change to within the same field:

index 1 is 10

index2 is 20  

is there is functions to insert a carriage return with the Formula? or Regex has this feature? Thanks!
12 REPLIES 12
jeblucas
5 - Atom

The Email widget only respects newlines if you type out the Body portion and have them there. If, like me, you need to have the Body be a field because it's constructed in the flow, you need to make sure your field has <br /> tags in it to get newlines. 

 

If your "fullBody" formula is something like 

[body1] + "

" + [body2] + "

" + [body3]

 

It will look OK in a preview, but passing this to "Body: Use a field" in the Email widget will turn the newlines into spaces in the HTML formatted message.

 

If you want to pass newlines into "Body: Use a field" your fullBody formula would need to be

[body1] + "<br />"

+[body2] + "<br />"

+ [body3]

ColinG
6 - Meteoroid

Unfortunately if you are using a report text tool and a render tool to write to PDF then Ned and jeblucas suggestions do not work.

 

Lepome's suggestion might work but in my situation would be a silly number of tools to join everything back together because I have some logic in mine (i.e.) 

 

If !IsEmpty([Field 2]) then
[Field 1] + (carriage return that doesn't work in Alteryx) + [Field 2] else
[Field 1] endif

Alteryx many vagaraties frequently become exhausting. This should be easy to do or find the answer in 5 minutes. I've been at it almost 2 hours. I'm about to have to restructure my whole flow to account for the fact I can't figure it out right now, and that will take several additional hours. 

ColinG
6 - Meteoroid

Actually Lepome's suggestion didn't work either. When I created the concatenated field with the carriage return and line break in a report text tool, and then later used that field in a 2nd report text tool where I really need it to work, instead I got the below output visible in the PDF. 

This forum software is a little too smart for it's own good. I couldn't paste the text directly in or it would say not allowed. I couldn't find a way to encapsulate/escape it to just display. I couldn't show a screenshot of the actual PDF due to needing to redact the name and title of the person I was using.

 

0UtA3JFwz0.png

Labels