cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Using a patch to update a task list to say task has been complete

Hi,

 

I am currently working on an app which shows a number of sanitation tasks for a number of different people. I have filters which will narrow the task list down so that Joe Bloggs can narrow the task list (a gallery) down to show his tasks for the day. From there I want Joe to go into each task to say if they have been completed. I currently have a detail form showing the tasks and then an edit form below to show it's been completed. I don't want Jo to be able to change any of the task information so do not want the screen to be made up entirely from a edit form. I know I then need to Patch the 'completed' data into my original data source but I am struggling getting the edit form data to tie upn with the particular record that I want updating (ie task 7)

So far I have this...

Patch('Pilot T San', {Completed:DataCardValue60.Value}) but this is just creating a new line in my data source rather than updating a current record.

 

Any h

 

4 REPLIES 4
Highlighted
Anonymous
Not applicable

Re: Using a patch to update a task list to say task has been complete

You need to point the Patch command to the specific record you want to Patch.

 

Patch(Datasource, LookUp(Datasource, Task = Task 7, {Complete: DataCardValue60.Value}))

 

Something like that. I'm  not sure what your data looks like so you'll probably have to adapt what put above. If you don't point to a specific record it'll just make a new one. 

Highlighted
Community Support
Community Support

Re: Using a patch to update a task list to say task has been complete

Hi @AllyCrop ,

Do you want to edit a record not create a new record?

Firstly, the right syntax of Patch function is:

Patch(tablename,Defaults(tablename),{....})     //create a new record
Patch(tablename,the exsiting item that you want to edit,{....})        //edit an existing record

 Usually, we use LookUp() function or First(Filter()) function to get the existing item that you want to edit.

 

Could you tell me 

1)is "task 7" one field's value?

2)the field data type that "task 7" belongs to?

3)what your data source is?

I assume that "task 7" is a text field value. If so, try this formula to update:

Patch(Datasource, LookUp(Datasource,Task ="task 7"), {Complete: DataCardValue60.Value})
//Patch(Datasource, LookUp(Datasource,fieldname =....), {Complete: DataCardValue60.Value})
please replace with your tablename, fieldname

 Here's a doc about Patch function for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Using a patch to update a task list to say task has been complete

Yes I want to update an existing record.

My Datasource is a sharepoint list called Pilot TC San.

I am using the ID column as a unique identifier.

The task that is to be 'Completed' will change so have tried to point the look up at the revelant data card

 

Patch('Pilot TC San',Lookup('Pilot TC San',ID=DataCardValue51,{Completed:DataCardValue60.Value}))

 

DataCardValue51 is the showing the ID

 

This is showing an issue of an invalid argument

Highlighted
Anonymous
Not applicable

Re: Using a patch to update a task list to say task has been complete

Make sure data types match up. What kind of input is DataCard51 using? If it's a text input and ID is a number you probably need to change the format property to Number. OR if ID is string type you will need to make sure your datacard value comes out as a string. You can also use Value(DataCard51Value) to turn a string into a number (assuming a number is entered) or you can use Text(DataCard51Value) to turn it into a string.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (9,837)