form does not update after patch using varRecord
-
form does not update after patch using varRecord
Posted by DSC Communities on June 22, 2020 at 5:07 am-
Stefan SauerlƤnder
MemberJune 22, 2020 at 5:07 AM
In my canvas app I am connected to a sharepoint list, having one screen with a gallery and several forms and text fields.
In the gallery I set OnSelect:
Set(varRecord, ThisItem)
Also in the forms I made Item:
varRecord
Using Patch I am patching all fields from the forms back to sharepoint, which works fine, no issue so far.
Patch( datasource, varRecord, {Title: DataCardValue45.Text}, {Assignee: DataCardValue23.Selected}, ... ...
However after patch I still see the old record data in the form, not the changed and saved.
This used to work ok when I still was using gallery.selected instead of varRecord in the forms.
Only when I reselect the item in the gallery again, the form updates with the current data.
I tried playing with Set(varRecord, ThisItem) in the patch statement, but that didnt change anything.
When I check the variable content (View | Variables) I still see the content from before patch, when reselect the gallery Item, the variable updates and the updated data is displayed.
How can I update varRecord without relecting the gallery item after patch, so I can display the updated data in the forms?
thanks!
——————————
Stefan SauerlƤnder
Business Analyst
Ratingen
—————————— -
Add a Lookup()
Patch(
datasource, Lookup(Data, varRecord.ID = ID),{Title: DataCardValue45.Text},
{Assignee: DataCardValue23.Selected},
…
…——————————
Dennis Newcomb
Digitalms365.com
dennis.newcombjr@Digitalms365.comNeed remote help today?
Book sometime with my at Digitalms365.com/bookings
——————————
——————————————- -
Stefan SauerlƤnder
MemberJune 22, 2020 at 3:50 PM
thanks Dennis, but that doesnt work either, no update to the form after patch.
using
Patch(
datasource, Lookup(colVC, varRecord.ID = ID),
…where colVC is a collection I use for filtering the gallery and a subset of datasource
——————————
Stefan SauerlƤnder
Business Analyst
Ratingen
——————————
——————————————- -
Are you traying to Patch the Collection or your data source ?
——————————
Dennis Newcomb
Digitalms365.com
dennis.newcombjr@Digitalms365.comNeed remote help today?
Book sometime with my at Digitalms365.com/bookings
——————————
——————————————- -
Warren Belz
MemberJune 22, 2020 at 4:24 PM
Just a suggestion – Patch Syntax could bePatch( datasource, {ID:varRecord.ID}, { Title: DataCardValue45.Text, Assignee: DataCardValue23.Selected ... ... } )
You can also do
Patch( datasource, {ID:varRecord.ID}, YourFormName.Updates )
or even this
UpdateIf( datasource, ID=varRecord.ID ), YourFormName.Updates )
——————————
Warren Belz
Queensland Australia
——————————
——————————————- -
Stefan SauerlƤnder
MemberJune 23, 2020 at 2:18 AM
thanks for all you suggestions, really appreciate it.
the patch statement works ok (I am patching the datasource), no matter which syntax I am using, the changes are stored fine in the sharepointHowever what does not change is that varRecord does not update after the patch statement and therefore the form does not reflect the stored changes.
In order to see the stored change I need to re-select the gallery item, which will update varRecord (-> Set(varRecord, ThisItem))
——————————
Stefan SauerlƤnder
Business Analyst
Ratingen
——————————
——————————————- -
Martin Achermann
MemberJune 23, 2020 at 3:50 AM
Hi Stefan
The patch function returns the new patched record as result.
All you need to do is to encapsulate your patch statement into a SET function.
–> Set(varRecord,patch(<yourPatchStatement>))This will bring your updated Record back into your variable.
Regards
Martin——————————
Martin Achermann
——————————
——————————————- -
Stefan SauerlƤnder
MemberJune 23, 2020 at 3:39 PM
perfect, thanks, thats it, varRecord gets updated as well as te SP list š——————————
Stefan SauerlƤnder
Business Analyst
Ratingen
——————————
——————————————-
DSC Communities replied 5 years, 2 months ago 1 Member · 0 Replies -
-
0 Replies
Sorry, there were no replies found.
The discussion ‘form does not update after patch using varRecord’ is closed to new replies.