cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JMAFO
Helper V
Helper V

Add line break in text stored in array

Hello everyone,

 

Is it possible to add line breaks to text that is stored in an array? My text loses line breaks and formatting when it is appended to the array variable. 

For instance, the current array: 

{
  "Name""John Doe",
  "Interests""Golf TV Movies"
}

Desired Array: 
{
  "Name""John Doe",
  "Interests""Golf
                     TV
                     Movies"
}



1 ACCEPTED SOLUTION

Accepted Solutions
efialttes
Super User
Super User

Yes, we can!

Assuming you got you example object stored in a variable called 'myInputObject' of type object (you should add an Initialize variable somewhere before) I would add a Compose action block, let's call it 'Compose auxString', and assign as its value the following wdl expression:

 

 

join(split(variables('myInputObject')?['Interests'],' '),'

')

 

 

Please note I am hitting Enter key on my keyboard to add a New Line before typing the last ')

 

Now, I would add another Compose action block, let's call it 'Compose auxObject', assign as its value 'myInputObject'

Finally, you need a 'Set variable' action block, select name 'myInputObject', assign as its value the following expression:

 

 

setProperty(outputs('Compose_auxObject'),'Interests',outputs('Compose_auxString'))

 

 

Flow_NewLine_1.png

 

Please note in most of the contexts you wanna visualize the new lines, this approach should work or... but if it is an HTML based, then you can try to assign the following WDL to 'Compose auxString' instead...

 

join(split(variables('myInputObject')?['Interests'],' '),'<br/>')

 

...and it should do the trick

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

3 REPLIES 3
efialttes
Super User
Super User

Yes, we can!

Assuming you got you example object stored in a variable called 'myInputObject' of type object (you should add an Initialize variable somewhere before) I would add a Compose action block, let's call it 'Compose auxString', and assign as its value the following wdl expression:

 

 

join(split(variables('myInputObject')?['Interests'],' '),'

')

 

 

Please note I am hitting Enter key on my keyboard to add a New Line before typing the last ')

 

Now, I would add another Compose action block, let's call it 'Compose auxObject', assign as its value 'myInputObject'

Finally, you need a 'Set variable' action block, select name 'myInputObject', assign as its value the following expression:

 

 

setProperty(outputs('Compose_auxObject'),'Interests',outputs('Compose_auxString'))

 

 

Flow_NewLine_1.png

 

Please note in most of the contexts you wanna visualize the new lines, this approach should work or... but if it is an HTML based, then you can try to assign the following WDL to 'Compose auxString' instead...

 

join(split(variables('myInputObject')?['Interests'],' '),'<br/>')

 

...and it should do the trick

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Thanks for your solution, this would work for the question asked. Cheers!

Issue solved?

Hurray!

Thanx for your kindness and Happy Flowing!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (2,783)