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

Embedded Newlines in Report Text/Email tool

DBParker
6 - Meteoroid

I have a string field that contains embedded newlines in it.  I ultimately want to include this field in an email being sent as part of the workflow.  The embedded newlines are important to me and want them to be "seen" in the email.  Without these newlines being seen the field looks like one big, nonsensical, run on sentence, hence the importance of these embedded newlines.

 

Is there a way that I can do this?

 

I don't want to split the existing field into new columns and then piece them back together in the Report Text tool if can avoid it in any way.  I say this because there is no consistent number of embedded newlines.  There could be 4 or 50 so I'm looking for a different solution.

 

Below is an example one of the fields:

 

Methods:  Known to me Issue Type:  General Issue:  test only Sought:  testing

 

And here is what it should look like with the "seen" embedded new lines:

 

Methods:  Known to me

Issue Type: 

General Issue:  test only

Sought:  testing

 

Not all fields will follow this pattern as the number of lines can vary significantly.

 

1 REPLY 1
DBParker
6 - Meteoroid

With a bit more sleuthing I was able to resolve this in the way I wanted.

 

The post below provides a great way to include the newlines (aka line breaks) in a table:

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Working-with-wanted-line-breaks-and-th...

 

In the example in the link above the table is the only thing included in the email but I needed to include other info in the body of the email so this wasn't the ultimate solution.  Instead I had to join the Table field created in the steps detailed in the link above back into the rest of my data.

 

After the join I then added a Text tool that provided all of the other information I needed to include in my email, except for the Table field.  I couldn't include the Table field because at this point it is a string full of HTML code.  To address this I added a Formula tool where I edited the new Text field (called Email Body) like below:

 

[Email Body]+[Table]

 

This results in the Email Body field being a combination of two HTML fields that I can now include as the Body in the Email tool.  The screenshot below provides a better picture of how it all came together.

2021-03-04_17-44-17.png

 

 

At the end it resulted in an email exactly as I wanted it to appear.

 

Hope this might help anyone else in a similar situation!

Labels