cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MicSokoli
Frequent Visitor

How to add line break after , in power automate.

Hi

Is it possible to add line breaks in power automate? I have created a Forms answer and there is a question with a long line for text, the user has been instructed to end the line with a ",", I would therefore like to break the lines in the power automate so that when the flow sends me an email with new answers, the answers should be filtered according to this way.
Answer 1
Answer 2
Answer 3
Today I get these answers: answer 1, answer 2, answer 3.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Caspar_Rubin
Responsive Resident
Responsive Resident

Hey,

 

you could create a variable (initialize variable action) named "NewLine", Type "String" and Value is just a new line (press enter once inside the text field)

Then you can use the replace() function to replace all commas with the NewLine variable. 

Expression used: 

 

replace(outputs('Compose_-_Anwer'), ',',variables('NewLine'))
 
change the 'outputs('Compose_-_Anwer')' part with the dynamic value of the answer of the form...
 
So basically this:
 
Caspar_Rubin_0-1659433744637.png

 

 

results in this:

 

Caspar_Rubin_1-1659433759883.png

 

 

let us know if this works for you!

 

cheers

View solution in original post

Paulie78
Super User
Super User

Because your intended output is an email, you want a BR tag, not a new line. Take a look at the following:

 

break.png

This produces the output:

answer 1<br /> answer 2<br /> answer 3

Which would work well in your email.

The expression I used is:

replace(outputs('Compose'), ',','<br />')

You would need to replace: outputs('Compose') with the response from your form.

 

Blog: tachytelic.net

YouTube: https://www.youtube.com/c/PaulieM/videos

If I answered your question, please accept it as a solution 😘

View solution in original post

4 REPLIES 4
Caspar_Rubin
Responsive Resident
Responsive Resident

Hey,

 

you could create a variable (initialize variable action) named "NewLine", Type "String" and Value is just a new line (press enter once inside the text field)

Then you can use the replace() function to replace all commas with the NewLine variable. 

Expression used: 

 

replace(outputs('Compose_-_Anwer'), ',',variables('NewLine'))
 
change the 'outputs('Compose_-_Anwer')' part with the dynamic value of the answer of the form...
 
So basically this:
 
Caspar_Rubin_0-1659433744637.png

 

 

results in this:

 

Caspar_Rubin_1-1659433759883.png

 

 

let us know if this works for you!

 

cheers

MicSokoli
Frequent Visitor

Hi Caspar
Thank you for the answer.

I dont understand what you mean by "change the 'outputs('Compose_-_Anwer')' part with the dynamic value of the answer of the form..."

I will send you my flow and you can see what i have done wrong since its not formating.

Please see pictues below.

Pic1.PNGPic2.PNG

 

Paulie78
Super User
Super User

Because your intended output is an email, you want a BR tag, not a new line. Take a look at the following:

 

break.png

This produces the output:

answer 1<br /> answer 2<br /> answer 3

Which would work well in your email.

The expression I used is:

replace(outputs('Compose'), ',','<br />')

You would need to replace: outputs('Compose') with the response from your form.

 

Blog: tachytelic.net

YouTube: https://www.youtube.com/c/PaulieM/videos

If I answered your question, please accept it as a solution 😘

Than you Paulie this did it! and also thank you very much Caspar!

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (2,110)