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

      Member

      June 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
      ——————————

    • Dennis Newcomb

      Member

      June 22, 2020 at 2:36 PM

      Add a Lookup()

      Patch(
      datasource, Lookup(Data, varRecord.ID = ID),

      {Title: DataCardValue45.Text},
      {Assignee: DataCardValue23.Selected},

      ——————————
      Dennis Newcomb
      Digitalms365.com
      dennis.newcombjr@Digitalms365.com

      Need remote help today?
      Book sometime with my at Digitalms365.com/bookings
      ——————————
      ——————————————-

    • Stefan SauerlƤnder

      Member

      June 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
      ——————————
      ——————————————-

    • Dennis Newcomb

      Member

      June 22, 2020 at 3:54 PM

      Are you traying to Patch the Collection or your data source ?

      ——————————
      Dennis Newcomb
      Digitalms365.com
      dennis.newcombjr@Digitalms365.com

      Need remote help today?
      Book sometime with my at Digitalms365.com/bookings
      ——————————
      ——————————————-

    • Warren Belz

      Member

      June 22, 2020 at 4:24 PM

      Just a suggestion – Patch Syntax could be

      Patch(
         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

      Member

      June 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 sharepoint

      However 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

      Member

      June 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

      Member

      June 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.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!