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 / Why is my Patch throwi...
Power Apps
Unanswered

Why is my Patch throwing an error?

(0) ShareShare
ReportReport
Posted on by 106

Hello everyone please help. I am trying to put a patch function to the "OnSelect" property of a checkbox, the goal is to update the Status column. The problem is patch is throwing "some invalid arguments" when I click the get help option it says that the specified column "Date" does not exist. I don't understand why this is causing an error "Date" doesn't exist because it is a column created using AddColumns and it is used in a label but not in the patch formula. I tried removing and reconnecting the data sources which is two excel tables but not change. 

 

Patch(Trainees, ThisItem, {Status: "Completed"})

 

If it's helpful I merged the two excel tables in the gallery. 

Categories:
I have the same question (0)
  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    @jan_mac 

    are you updating a choice field if yes you need to modify the code like below 

     

     

     

     

     

    Patch(Trainees, ThisItem, Status: {Value: "Completed"}
     })

     

     

     

    For the date the reason you getting is you’ve added a extra field and you data source is not existed, all you have to do use 

    DropColumns(MenuDataColl,"Item")

     Or lookup where you put ThisItem but try the first code I have modified 

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @jan_mac ,

     

    You could also use Updateif function for updating the data. 

    UpdateIf(Trainees,ID=ThisItem.ID,{Status: "Completed"})

     

  • jan_mac Profile Picture
    106 on at

    Hi I tried the first code it didn't work as for my data source I tried using a single table only and that eliminated the error in the checkbox so I guess the problem is the added Column "Date" but I don't understand why it would cause an error since it's not the only added columns. As for the dropColumns where am do i put it on the gallery or on the checkbox? 

  • jan_mac Profile Picture
    106 on at

    I also tried this it could work, however this code would update all rows. Do you know a way to only update the checkbox that was checked by the user? 

  • jan_mac Profile Picture
    106 on at

    I've traced the problem now it is my added columns since patch returns the modified record it cannot return a column or a record that doesn't exist which is why it is throwing an error.  That being said is there way to update a table even though there are added columns to it?

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @jan_mac,

    UpdateIf will update only row if you write the condition which returns only one row. You can try updateif only for selected checkbox also, using updateif you can update min row with min one column value.

    If you can share more details on your requirement I'm happy to help.

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Put the code Oncheck of the Checkbox 

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    @jan_mac 

    Try this please and let me know 

     

     

     

    Patch(Trainees, LookUp(Trainees,ID = ThisItem.ID), {Status: "Completed"})

     

     

     

    Capture1.JPG

  • jan_mac Profile Picture
    106 on at

    Hi Thank you for your reply however my table doesn't  have an ID column the only unique column is the TrainingID which is used like a foreign key to reference the Training List table.

     

    Trainees Table

    Name 

    TrainingID

    Status

     

    TrainingList Table

    TrainingID

    TrainingName

    Date Completion

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

     

    Patch(Trainees, LookUp(Trainees,TrainingID = ThisItem.TrainingID), {Status: "Completed"})

     

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 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard