cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tre4B Advocate IV
Advocate IV

How can you enter a Newline into a string?

I'm trying to update a description field in a string.  I want to add a newline between each update, I just cannot figure out how.

 

I've tried the normals like \n \\n etc. and I've looked for Expression functions like Newline, char.

 

How can I do this?

16 REPLIES 16
tre4B Advocate IV
Advocate IV

Re: How can you enter a Newline into a string?

Answering my own question as I found a work around.   I used

 

json('{"NL":"\n"}')?['NL']

 

and this seemed to work fine  🙂  If there is an easier way though I would still like to hear it.

Anonymous
Not applicable

Re: How can you enter a Newline into a string?

Hello @tre4B!

I have the same problem and still cannot make it work 😞

Did you use the json code in a "Variables\Append to String" Action or maybe Compose? 

 

My goald we be to just enter a new line after the built string variable:

variable.PNGAction "append to string variable"

WillyD44 Kudo Collector
Kudo Collector

Re: How can you enter a Newline into a string?

Hey tre4B - Glad you figured this out.  I am not able to get it to work for me however.  I put the string you shared below into an Expression in my Multi-Line Text Field (Comments-).  See below.  

 

How did you get your solution to work?

 

FLOW-Image.png

 

sgilchrist
Regular Visitor

Re: How can you enter a Newline into a string?

Hi

 

Did you ever get an answer to this? I'm trying to do the same thing.

 

Cheers

Anonymous
Not applicable

Re: How can you enter a Newline into a string?

Hi!

Unfortunately not. I mainly needed it to list several items and ended up creating an HTML table.

Jambo1 Advocate II
Advocate II

Re: How can you enter a Newline into a string?

I was struggling with this for a while and ended up using append to a string and just added a carriage return in there direcly by pressing the enter key 

sgilchrist
Regular Visitor

Re: How can you enter a Newline into a string?

Thanks

Administrator
Administrator

Re: How can you enter a Newline into a string?

Hello, @tre4B!

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @Jambo1‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!

Thank you for being an active member of the Flow Community!

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!
nicdlbdk
New Member

Re: How can you enter a Newline into a string?

Super cool, can you try to explain what json('{"NL":"\n"}')?['NL'] does, and are there other textformatting tips like this?

 

regards

Nicolai

AndreiCiurea
Frequent Visitor

Re: How can you enter a Newline into a string?

The way I've done it is by appending "</br>" to the string and ticking the "is HTML?" box on the email action

PepPower
Regular Visitor

Re: How can you enter a Newline into a string?

I was looking all over the place trying to figure out how to add a CRLF (or LF) to the end of strings I was writing to a file.  Simply creating a variable and initializing it with a <RETURN> key and then referencing the variable in my expression ended up with something like this (as a test):

 

join(createArray(convertTimeZone(body('Get_event_(V2)')['Start'],'UTC','Central Standard Time','dddd M/d/yyyy h:mmtt'),convertTimeZone(body('Get_event_(V2)')['End'],'UTC','Central Standard Time','dddd M/d/yyyy h:mmtt')),variables('CarriageReturn'))

 

This wrote my dates to my file (stored on OneDrive for Biz) which then showed up on my PC (like magic) with this content:

 

Thursday 2/7/2019 10:00AM
Thursday 2/7/2019 10:30AM

 

So simple...yet so difficult to figure out!

 

Russ

EunjuHan
Frequent Visitor

Re: How can you enter a Newline into a string?

This answer would not cover a variety of diferrent cases, Howerver, if you would like to add new line between two daynamic values within a whole string, i just typed the enter key and it worked for me. 

so it will look like below:

'[Daynamic value1]

[Daynamic value2]'

 

Please note a single quotation at the beginning of the [Daynamic value1] and at the ending of [Daynamic value2].

Bill_Felix
Regular Visitor

Re: How can you enter a Newline into a string?

My scenario: 

  • TypeForm -> Flow -> Word Template
  • The 'Plain Text Content Controls' were expecting somewhere between 0 and 10 elements
  • Need to 'list' each element one per line in the final document

All of the above approaches fail.

 

However, I did stumble upon a setting in the Properties of the 'Plain Text Content Controls'
Annotation 2019-08-12 141722.png

And then this answer helped me: https://stackoverflow.com/questions/3091524/what-are-carriage-return-linefeed-and-form-feed

It helped me because it introduced '\r' as the 'Carriage Return' that I was looking for.

ShivaniSolanki
New Member

Re: How can you enter a Newline into a string?

Hi, 

You can follow the syntax below in 'Append to String' to start from a new line:

concat(.......... ,'<br />')

 

PS: ENTER key option only works when there are just two lines but not for more than that.

 

Regards,

Shivani Solanki

 

JRRRS
Frequent Visitor

Re: How can you enter a Newline into a string?

For multi-line fields, the easiest way is to use the Unicode for a newline and put \u000a wherever you want to add a newline in the PA JSON of a SharePoint field.

 

I haven't tried it on a single-line field, but it may work there too

IrhanC
Frequent Visitor

Re: How can you enter a Newline into a string?

thx this worked for me !

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (6,866)