web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Bug: Substitute functi...
Power Apps
Answered

Bug: Substitute function in gallery

(0) ShareShare
ReportReport
Posted on by 284

Hi,

 

I have a horizontal gallery showing the names of employees. In the interest of saving horizontal screen space I want to replace the space character with a new line character. This should result in the first name displaying ontop of the last name. This however does not happen for all iteams in the gallery. To replicate the issue i have put together the folowing simple example:

 

1. Create a collection containing first and last name:

ClearCollect(Collection1, 
 {Name: "Anthony Phan"}, 
 {Name: "John Smith"}, 
 {Name: "Kevin Do"}, 
 {Name: "Aaron Oxford"}
)

2. Great a horizontal gallery and assign Collection1 as the data

3.Insert a label inside the gallery with the text field according to the follwoing formula

Substitute(ThisItem.Name, " ", Char(13))

For some reason only the first iteam will replace the space character with a new line character. All subsequent records will just remove the space character and show the first an last name side by side as shown in the attached image.

 

 

 

 

gallery bug.PNG
Categories:
I have the same question (0)
  • Verified answer
    Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    I got it to work but I don't understand why. I followed your directions (awesome job) and I was able to reproduce your issue. Then I was playing around with it I discovered that if I made a change to the Items property of the gallery it refresh the items in the gallery and the names displayed as expected.

    Try this and see if it works for you. follow your same instructions and then go to the Items property of the gallery and remove the formula wait a few seconds then add it back in. Then see if the names are displaying as expected with the split code.

  • AnthonyPhan Profile Picture
    284 on at

    Hi Jeff,

     

    I appreciate the response. This also worked for me. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard