cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FoDelement
Continued Contributor
Continued Contributor

Compose output missing new lines

Hello again,

 

I am working on a flow that emails a few fields from a SP list item as a text file. The problem is, when the text file arrives, it's missing the new lines. Is there something I can do, to have the line returns carry over to the attachments?

 

 

1.jpg

2.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
FoDelement
Continued Contributor
Continued Contributor

Okay, I fixed it!

 

The peek code is what helped me solve it. I noticed, it was sending returns as \n where as notepad requires them to be \r\n

So this expression is what fixed it for me.

 

json('{"NL":"\r\n"}')?['NL']
Thank you for your help!
 
2019-03-19 09_52_39-Start.jpg
 
 

View solution in original post

9 REPLIES 9
AlanPs1
Resident Rockstar
Resident Rockstar

Hi @FoDelement 

When you say "it's missing the new lines.", are you referring to the spaces you have created below, the carriage returns?:Capture-382.png

Are you looking for your output to be:

 

"William

 

Sharpe" ?

 

If so, set email to HTML and use <br> (or multiple <br><br>) for a line break or carriage return (in your Compose) is one easy way and the way I favour.

 

If you have found my post helpful, please mark thumbs up.

Any other questions, just ask.

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


FoDelement
Continued Contributor
Continued Contributor

Hello, and thank you for your reply.

It is going to the email as an attachment. (In this case a .txt) so it does not support HTML.

I did however try and do a "convert from HTML" and use that output for the attachment, to the same results.

Hi @FoDelement 

Sorry, I missed that. I though maybe the txt file was for demo purposes.

Either way, I have recreated your Flow and have tested with values from a list and raw text in a compose as you have.Capture-384.png

Both my text files have output with the carriage returns present:Capture-388.pngCapture-385.png

and from the list data:Capture-387.png

Capture-386.png

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


FoDelement
Continued Contributor
Continued Contributor

I just tried it again and got the same results. (Different PC, just to see if it was a notepad issue) 

 

Is this how you have the email set up?

 

 

Capture.PNG

EDIT: I decided to test it a different way, this time creating a onedrive file, and I get the same result.

 

2019-03-19 08_43_16-Run History _ Microsoft Flow.jpg

 

So I decided to open the file with notepad++ and it has the returns!

The issue seems to be with notepad, but I tried two different machines. The only common variable I can think of, is that they are both windows 10. I will test it on a windows 7 machine and see what happens.

Hi @FoDelement 

I used Windows 10 in my testing last night.

Yeah, looks like notepad in some way.

 

My email is set up the same way although I have put text in the body as it is a mandatory field. But that is all.

 

This posts - https://superuser.com/questions/362087/notepad-ignoring-linebreaks , seems to have additional information on the issue, you may have seen this already.

 

Glad to clarify it is not a Flow issue and the Flow works well as do you!

 

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


FoDelement
Continued Contributor
Continued Contributor


 

Glad to clarify it is not a Flow issue and the Flow works well as do you!

 

 


Same result on the windows 7 machine.  For your carriage returns, you were not using anything fancy outside of pressing the enter key by chance, were you?

 

{
    "inputs": "Why\nWont\nThis\nWork"
}

This is my input for the "Compose" action. (Using the peekcode function)

FoDelement
Continued Contributor
Continued Contributor

Okay, I fixed it!

 

The peek code is what helped me solve it. I noticed, it was sending returns as \n where as notepad requires them to be \r\n

So this expression is what fixed it for me.

 

json('{"NL":"\r\n"}')?['NL']
Thank you for your help!
 
2019-03-19 09_52_39-Start.jpg
 
 

View solution in original post

What is "NL".

Would you please show what is under the compose

json('{"NL":"\r\n"}')?['NL']
Vlad1
Frequent Visitor

Amazing, thank you so much!! I spent couple hours of struggling to find the solution 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,209)