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

Notifications

Announcements

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 531

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard