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 / How to patch an variab...
Power Apps
Answered

How to patch an variable when already in use?

(1) ShareShare
ReportReport
Posted on by 997

Hello,

how can i patch an variable when already been used with data

I need to update 1 column only in this existing variable, but this gives me an error

Set(checkedEdit; Patch(checkedEdit.ID; {tmp: TextInput3_1.Text}))

The checkedEdit is been created in a gallery when pressing a button

Set(checkedEdit;ThisItem)

 Thank you

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @TimmyBoy 

    You can't. You must use a collection or some other way.

  • TimmyBoy Profile Picture
    997 on at

    Hi @poweractivate 

    Oh, Well i want too update this variable when i patch it inside the sharepointslist

    So my data will be refreshing like my image
    It has the checkedEdit.tmp
    So when updated in the sharepointslist this data isn't updated
    But thats sad
    Do you have a suggestion how i can do it in a other way
    So i still update the image with my updated image?
    Thank you

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    Try this:

    Patch the SharePoint List:
    Update the SharePoint list with the new 'tmp' value and any other necessary changes.

     

    Patch(yourSharePointList, {ID:ThisItem.ID,tmp: TextInput3_1.Text})

     

    Refresh the SharePoint List:
    After patching the SharePoint list, you might need to refresh the data to ensure it's up-to-date in the app.

     

    Refresh(yourSharePointList)

     

     

    See if it works with neither variable nor collection

    See if it helps @TimmyBoy 

  • Verified answer
    timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @TimmyBoy 

    I think you might have just made a mistake in your call to Patch - there's no need to specify .ID in the item to patch. If you try the following, does it work?

    Set(checkedEdit; Patch(checkedEdit; {tmp: TextInput3_1.Text}))
  • TimmyBoy Profile Picture
    997 on at

    hi @timl 

    No, its gives me this error

    the second argument to the 'index' function must be between 1 and 1.
    the lower and upper limits of the table.
    The upper limit can be lowered due to the non-transfer limit.

     Even no idea what it means 😞

  • TimmyBoy Profile Picture
    997 on at

    Hi @timl ,

    My apologies

     

    //patch
    Set(varNewImage; Blank());;
    If(!IsBlank(TextInput3_1.Text);
     Set(varUpdatingPhoto; true);;
     // Patch
     Patch(
     myData;
     LookUp(myData; 'Id (ID)' = checkedEdit.ID);
     { tmp: TextInput3_1.Text }
     );;
     Patch(
     colMyData;
     LookUp(colMyData; ID = checkedEdit.ID);
     { tmp: TextInput3_1.Text }
     );
     // Reset
     Set(varNewImage; Blank());;
     Set(varUpdatingPhoto; false);;
     Set(varError; "");;Set(checkedEdit; Patch(checkedEdit; {tmp: TextInput3_1.Text}))
     ;
     Reset(TextInput3_1);;
     Set(varError; "Error: tmp is blank.")
    );;
    Set(varOkBox; false);;
    Set(varItem; Blank())

     

    It seems there's a error in my own code
    And not yours.
    Even i have no idea what line cause this error

  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @TimmyBoy 

    This is not a error that I've seen before. What data source are you using? Is it Dataverse?

    If you just try to do a Patch agaisnst the data source, do you get the same error?

     Patch(
     myData;
     LookUp(myData; 'Id (ID)' = checkedEdit.ID);
     { tmp: TextInput3_1.Text }
     )

    If not, I would attempt to run each part of the code in isolation to determine the line that's causing the error.

    It might also be useful if you screenshot and post the error.

  • TimmyBoy Profile Picture
    997 on at

    Hi @timl 

    I use SharePoint list

    And nope the patch works fine,

    I will look into it as you suggested
    to go over each line
    I will be back, if this has been solved at mine side 😉
    If not i will make a screenshot 😄

     

    Thank you

  • TimmyBoy Profile Picture
    997 on at

    @timl 

    Okay, seems the error comes only when i patch the collection

     Patch(
     mycollection;
     LookUp(mycollection; 'Id (ID)' = checkedEdit.ID);
     { tmp: TextInput3_1.Text }
     )

    Patch into the SharePoint list it works well
    So why does the error comes on the collection?
    Any ideas...
    Thanks

  • TimmyBoy Profile Picture
    997 on at

    @timl  & @poweractivate 

    Got it solved

    Seems i only need

    Set(checkedEdit; Patch(checkedEdit; {tmp: TextInput3_1.Text}))

    This line to update the column, this gives no error 😊

    Thank you both for the awesome support 🤗

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard