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 / Left function throws e...
Power Apps
Unanswered

Left function throws error - Second argument invalid

(0) ShareShare
ReportReport
Posted on by 593

I am using powerapps gallery with SharePoint as the backend. I have multiselect people picker column which i am showing in gallery label. Below is the code for the same.

 

With(
 {
 wString: Concat(
 ThisItem.Team_Members.DisplayName,
 DisplayName & ", "
 )
 },
 Left(
 wString,
 Len(wString) - 2
 )
)

 

It was working fine for a while. However recently i noticed a weird error in app runtime. May i know what is the issue here?

 

Iantaylor2050_0-1700654124981.png

 

Categories:
I have the same question (0)
  • Chris-D Profile Picture
    1,246 on at

    This could happen if the second argument was negative. If ThisItem.Team_Members.DisplayName is blank then your second argument will be -2. Looks like you're using a gallery and this can happen before the gallery items have loaded. 

     

    Try this:

    With(
     {
     wString: Concat(
     ThisItem.Team_Members.DisplayName,
     DisplayName & ", "
     )
     },
     Left(
     wString,
    
     // Use max to ensure value cannot be negative
     Max( 0, Len(wString) - 2)
     )
    )

     

  • RodCha Profile Picture
    216 on at

    If you are using the 'Formula' in the 'Label' control for your gallery, you can try:


    With({name: ThisItem.DisplayName}, name & ", " & Left(name, Len(name) - 2))

     

    But, I'm not sure if this the place that you are trying to use it.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard