cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Patch Help

Trying to patch the onstart record when the user navigates to another screen. Onstart works fine but the Patch is not. Any help would be great.

 

On Start:

Collect(DWAnalytics,{UserName:Office365Users.MyProfile().DisplayName,UserEmail:Office365Users.MyProfile().Mail,LoginDate:Today(),LoginTime:Text( Now(),"[$-en-GB]hh:mm:ss"),UniqueID2:Office365Users.MyProfile().Mail&Text(Now(),"[$-en-GB]hhmmss")});

Set(UniqueValue,Office365Users.MyProfile().Mail&Text(Now(),"[$-en-GB]hhmmss"))


Text Label (UniqueID): Text Property is UniqueValue


Another Screen, On Visible:

Patch(DWAnalytics,{UniqueID2:UniqueID.Text},{Office365Screen:"Y"})

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @BenGillard ,

The right syntax of Patch should be:

Patch( DataSource, BaseRecord, ChangeRecord)

 

If you want to create a new record, use Defaults(DataSource) to represent BaseRecord.

If you want to update an existing record, you should list the record that you want to update to represtent BaseRecord.

Usually, we use LookUp function to filter the record that you want to update.

 

For example:

Patch(DWAnalytics,LookUp(DWAnalytics,UniqueID2=UniqueID.Text),{Office365Screen:"Y"})

 

Here's a doc about this 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.

View solution in original post

5 REPLIES 5
Highlighted
Super User II
Super User II

Are you trying to add or update a record with the Patch()? 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Highlighted

Trying to update the record that is being created with the Onstart property.
Thanks
Highlighted

Ok, if I understand this there is a collection created when the app starts with one record and you would like to update that record. The issue I see is that Office365Screen doesn't exist when the collection is created.

 

I would recommend adding Office365Screen:"N" to the record when it is created in the OnStart

 

Then you should be able to use this Patch() to update the record:

 

Patch(DWAnalytics, First(DWAnalytics), {UniqueID2:UniqueID.Text , Office365Screen:"Y"})

 

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Highlighted
Community Support
Community Support

Hi @BenGillard ,

The right syntax of Patch should be:

Patch( DataSource, BaseRecord, ChangeRecord)

 

If you want to create a new record, use Defaults(DataSource) to represent BaseRecord.

If you want to update an existing record, you should list the record that you want to update to represtent BaseRecord.

Usually, we use LookUp function to filter the record that you want to update.

 

For example:

Patch(DWAnalytics,LookUp(DWAnalytics,UniqueID2=UniqueID.Text),{Office365Screen:"Y"})

 

Here's a doc about this 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.

View solution in original post

Highlighted
Helper III
Helper III

Thanks for the reply.
I have added N to the on start option.
Is there a way to patch without using the first call as I believe this will cause delegation issues?
The data set is already close to 2000 records and growing daily. Thanks

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,448)