Skip to main content

Notifications

Community site session details

Community site session details

Session Id : /NCV7B5BO9Hwhq9SrZ8/1g
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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

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

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 298 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 169

#3
stampcoin Profile Picture

stampcoin 130

Overall leaderboard
Loading started