Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ZhvngB6etoIRyo+XIBuWIr
Power Apps - Building Power Apps
Unanswered

Left function throws error - Second argument invalid

Like (0) ShareShare
ReportReport
Posted on 22 Nov 2023 11:56:01 by 494

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:
  • RodCha Profile Picture
    216 on 22 Nov 2023 at 12:18:47
    Re: Left function throws error - Second argument invalid

    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.

  • Chris-D Profile Picture
    1,246 on 22 Nov 2023 at 12:06:35
    Re: Left function throws error - Second argument invalid

    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)
     )
    )

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 27

#2
mmbr1606 Profile Picture

mmbr1606 14 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 13 Super User 2025 Season 1

Overall leaderboard