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

Working with (wanted) line breaks and the Table > Email tools

Scott_Snowman
10 - Fireball

I have a workflow that pulls from SharePoint, slices into various pieces based on project owner and status, and mails out separate tables based on the project owner's email address. No problem there.

 

The issue is the formatting of the table. As noted in LisaL's comment here the Email tool does not play well with new lines in data.

 

Here's how the data flows in from Sharepoint. The "Running Update Detail" field has new lines inserted.

 

Project IDProject Start DateLast Updated DateStatusRunning Update Detail
54A10-30-1710-31-17Pending parts

10/30: Dispatch requested review of functionality. Approved by Scheduling.

10/31: Dispatched agent reported that part code #34B1-LL/A was not functioning and needed to be re-ordered

23B10-24-1710-27-17Pending Scheduling approval

10/24: Dispatch requested review of functionality.

10/24: Due to remote location, Scheduling requested extension of project timeline

10/27: Approval from finance to extend project parameters

 

I can see that Alteryx recognizes the new lines because it does flag them in the Results panes.

 

However when the data is emailed out through Alteryx, the following occurs.

 

Running Update Detail

10/30: Dispatch requested review of functionality. Approved by Scheduling. 10/31: Dispatched agent reported that part code #34B1-LL/A was not functioning and needed to be re-ordered

10/24: Dispatch requested review of functionality. 10/24: Due to remote location, Scheduling requested extension of project timeline 10/27: Approval from finance to extend project parameters

 

Since there could be multiple lines of data flowing in per cell, I don't want to split apart into unique fields as in the linked solution because I don't know how many fields I'll need. (And I'm not aware of a "futureproof" method to do it easily if there is one.)

 

Is there a way to either:

 

  • Maintain the new line formatting in the email output,
  • Selectively bold the dates that separate updates so they're easier to spot, or
  • Another way to split out the data so it's visually easy to separate?
33 REPLIES 33
deepaprash
8 - Asteroid

Hello Scott,

 

I am trying to use @Patrick_dup_239's workflow too without success. My flow is a little different in that each email will have person specific text and table (related to that person) attached as part of the body. So I landed up creating a table with the email of each person, related table and Body of email via a formula. I tried to convert the body of the email into a table with line breaks as suggested but its not working. 

 

Here is my workflow. Can you tell me what I am doing wrong? 

 

Thanks!

Deepa

sanyajaleel
5 - Atom

Hello,

Would you please help me understand the the bold underline thing you have added. What does that $1 indicate and also why the bold and undeline command is ended with a colon

Scott_Snowman
10 - Fireball

@sanyajaleel Both the $1 and the : are parts of the Regex_Replace command to replace text.

 

The $1 represents the string I am capturing in the pattern, which is a date.

 

The colon is just the colon character as it exists in the original text, it is not a reserved character in this case.

 

So the expression is fulfilling the request, "Look for a string formatted as a date and followed by a colon, and replace it with the same string wrapped in <b> and <u> tags followed by a colon."

 

Using the colon in both the capture and replace parameters was necessary to help make sure that only dates followed by colons would get the bold and underline treatment. As a result, a date in the middle of a sentence would not be targeted this way.

sanyajaleel
5 - Atom
Hey scott, Unfortunately i amnot able to attach the workflow here , but my use case is as below: 2-3 days Eventually the pain starts subsiding in this period i want the data like this along with bold and underlined 2-3 days. i am getting some errors when i try to take reference from your code
Scott_Snowman
10 - Fireball

@sanyajaleel my code is specific to the RegEx pattern of looking for a date followed by a colon.

 

If you are looking to bold and underline the phrase 2-3 days then you need a different RegEx pattern.  If it's always a number, a dash, and another number followed by a space and then the word "days" then this should work:

 

Regex_Replace([text], "(\d+\-\d+\sdays)", "<b><u>$1</b></u>")

 

nslowey
5 - Atom

I'm attempting to use this solution and having difficulty doing so. I have a workflow that documents all formulas used in a target workflow, and I want to preserve any newlines entered in the formulas (which are usually for readability). However, when I run the data into a table tool, it's forced onto a single line. When I tried to apply the Regex_Replace solution presented here, it simply folded in the <br /> tag as if it were perfectly normal text, both in Browse and in the finished Render, as seen in the third row here:

 

nslowey_0-1644431509965.png

 

Has an update broken this functionality? All I want is to have these newlines be present in the Excel sheet that I'm generating.

AnnaQihua
5 - Atom

Hi Joshua, it works perfect for V-String, but failed on V-WString. V-WString will get some characters like "应收账款".

 

Appreciated if you have any solution.

PeterAP
8 - Asteroid

Thanks @patrick_digan - This solution really worked.

 

The browse after the table tool no longer shows results, but it does come out fine after the render tool. Hopefully this helps anyone else trying to implement this work around.

neelimakammila
5 - Atom

Hi Patrick,

 

Thank you for posting super formula for line break in E-mail tool, Request you to advise increase/ decrease the font size aswell

thulasir
7 - Meteor

Hi

 

I had the same issue. This helps a lot

Labels