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 / Sporadic issue: The se...
Power Apps
Answered

Sporadic issue: The second argument to the 'Left' function is invalid

(1) ShareShare
ReportReport
Posted on by 139

Hello Team,

We've been facing a peculiar issue with our app recently. We are getting a notification saying "the second argument to the 'Left' function is invalid error" when we are trying to patch a lookup column only with certain records sporadically. However, there is no impact on w.r.t functionality.  I tried to debug using First(Errors('Table_Name')).Message for the table that we are trying to patch and we do not see any issues whatsoever.

FYI, I tried both syntaxes such as saving the lookup column record into a variable and then patching it as well as adding a LookUp() method directly into the patch without any luck. Did any syntax change recently?
If I stop patching a LookUp column then I am not seeing this issue there.


Also, we are getting this issue in a couple of other places such as ResetForm(Form_Name) and Navigate methods also. It's happening very recently. We never had any issues with the same piece of code before. 

 

Thanks,
Srinivas

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @sthota 

    You will need to identify the formula that is producing the error.

    Use the Monitor Tool to try and identify where the error is happening.  Then review the parameters of the Left function to determine the problem.

     

    I hope this is helpful for you.

  • sthota Profile Picture
    139 on at

    @RandyHayes  Thank you so much for your insights and prompt response. We could find the root cause of this issue in one place using the monitor tool already. We will try and fix it and see if that resolves the issue. 

    Thanks,
    Srinivas

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I am also seeing this issue today.
    My left function was LEFT(string,LEN(string)-1)

     

    And in my case, there were cases when the string was blank and my -1 was causing this sporadically. (Only when the string variable was blank for some items)

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    As with the guidance in this post - you will need to run the monitor tool to tray and identify the formula that has that function in it. 

  • sthota Profile Picture
    139 on at

    @Anonymous I was facing a similar issue and I replaced with the following code to avoid these issues.

    If(
     Not(IsBlank(FieldName)),
     Trim(
     Last(
     FirstN(
     Split(
     FieldName,
     ","
     ),
     1
     )
     ).Result
     ),
     ""
    )

     

  • zacblais Profile Picture
    4 on at

    Hi @RandyHayes -- I've run into a similar situation with an empty string causing issues where a non-empty string behaves as expected. Notably, the field reporting the error does not include Left at all:

    ThisItem.'Asset type' & If(
     Not(ThisItem.'Asset type' = "Resource"),
     " - "
     & Switch(
     ThisItem.'Course type',
    		"Web-Based Training", "WBT",
    		"Instructor Led Training", "ILT",
    		"On-the-Job Training", "OJT",
    		"Other"
    	)
    )

    When a filter would leave ThisItem.'Asset type' empty, the error appears. Otherwise no error appears, as expected. This probably isn't too helpful in diagnosing it, but it does at least seem to be more than just a syntax error.

  • fellow_chucker Profile Picture
    4 on at

    I am having the same issue. Judging from this thread, these errors only recently started popping up. This suggests to me that there was some change to the way that this now functions. I have been using the "LEFT(string,LEN(string)-1)" for ages without any issue, and now, all of a sudden it doesn't work... This is extremely frustrating.

    The field that I use it on first separates Combo box selections:

    UpdateContext({combined_variable: Concat(ComboBox.SelectedItems,Value & ",")});

    and then removes the last character:

    LEFT(string,LEN(string)-1)

    It is only this LEFT function that is causing my errors, and only starting yesterday for me, but the App hasn't been used in a while, so it wouldn't have come up.

    If anyone has any real solutions, I would appreciate it. For now, as much as it pains me to do, I will have to allow for the trailing comma to remain.

  • fellow_chucker Profile Picture
    4 on at

    I don't understand how this has been allowed as a solution... this simply identifies how to find the issue, not how to solve it. The Left function is still causing errors. Judging from this thread, these errors only recently started popping up. This suggests to me that there was some change to the way that this now functions. I have been using the "LEFT(string,LEN(string)-1)" for ages without any issue, and now, all of a sudden it doesn't work.

    The field that I use it on first separates Combo box selections:

    UpdateContext({combined_variable: Concat(ComboBox.SelectedItems,Value & ",")});

    and then removes the last character:

    LEFT(string,LEN(string)-1)

    It is only this LEFT function that is causing my errors, and only starting yesterday for me, but the App hasn't been used in a while, so it wouldn't have come up.

  • T_A_M Profile Picture
    332 on at

    I was having the same issue suddenly, and I came up with a solution that has been working for me. The error with the Left function only seems to show up when the string in question is empty, so I wrapped my function with a If statement so that the Left function is only applied when the Combo Box is not empty:

     

    If(!IsEmpty(ComboBox.SelectedItems), UpdateContext({combined_variable: Concat(ComboBox.SelectedItems,Value & ",")}),

    LEFT(string,LEN(string)-1)), "")

  • CS-24071844-0 Profile Picture
    80 on at

    This worked for me - Thank you!

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard