cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SukhRehal
Regular Visitor

split string to new line - HTML

Hi all,

 

I have the below HTML code.

 

"<table border='1' width='100%'>" &
"<thead><tr><th>Location</th><th>Items</th></thead>" &
"<tbody>" &
Concat(gal_InstallationItems.AllItems, "<tr><td>" & Location & "</td><td>" & Item & "</td></tr>") &
"</tbody></table>"

 

 

within my gallery, the "Item" field is made up of a long string of items separated by a semi colon. Is there a way I can show the values after a semi colon to a new line?

 

so something like this.

 

Item1; Item2; Item3

 

to

 

Item1

Item2

Item3

 

Thank you for any help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

 

In addition to @CarlosFigueira's answer, you could also try substituting the semi colon with a <br/> like so:

"<table border='1' width='100%'>" &
"<thead><tr><th>Location</th><th>Items</th></thead>" &
"<tbody>" &
Concat(gal_InstallationItems.AllItems, "<tr><td>" & Location & "</td><td>" & 
Substitute(Item,";", "<br/>") & "</td></tr>") &
"</tbody></table>"

 

View solution in original post

3 REPLIES 3
CarlosFigueira
Power Apps
Power Apps

You can split the 'Item' property in its ';' characters, and concatenate them using "<br/>" (HTML new line), like in the example below:

"<table border='1' width='100%'>" &
"<thead><tr><th>Location</th><th>Items</th></thead>" &
"<tbody>" &
Concat(
    gal_InstallationItems.AllItems,
    "<tr><td>" &
        Location &
        "</td><td>" &
        Concat(Split(Item, ";"), Result, "<br/>") &
        "</td></tr>") &
"</tbody></table>"

Hope this helps!

timl
Super User
Super User

 

In addition to @CarlosFigueira's answer, you could also try substituting the semi colon with a <br/> like so:

"<table border='1' width='100%'>" &
"<thead><tr><th>Location</th><th>Items</th></thead>" &
"<tbody>" &
Concat(gal_InstallationItems.AllItems, "<tr><td>" & Location & "</td><td>" & 
Substitute(Item,";", "<br/>") & "</td></tr>") &
"</tbody></table>"

 

View solution in original post

SukhRehal
Regular Visitor

Thanks Guys,

as a follow on question I am trying to group by the first column, is this possible?

 

"<table border='1' width='100%'>" &
"<thead><tr><th>Location</th><th>Items</th></thead>" &
"<tbody>" &
Concat(
    gal_InstallationItems.AllItems,
    "<tr><td>" &
        GroupBy(Location) &
        "</td><td>" &
        Concat(Split(Item, ";"), Result, "<br/>") &
        "</td></tr>") &
"</tbody></table>"

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,161)