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"})
Solved! Go to Solution.
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,
Are you trying to add or update a record with the Patch()?
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"})
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,
User | Count |
---|---|
255 | |
114 | |
94 | |
48 | |
38 |