cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tre4B
Level: Powered On

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?

13 REPLIES 13
tre4B
Level: Powered On

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.

ManfredH83
Level: Powered On

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
Level 8

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
Level: Powered On

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

ManfredH83
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 159 members 5,388 guests
Please welcome our newest community members: