cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User III
Super User III

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
Super User III
Super User III

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

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (77,409)