cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
iamlee
Level 8

Patch function not saving all forms in my screen

I have a tabbed form using a gallery. If my item in the gallery is selected, it display the corresponding edit form. Example, if 'General' was selected from my gallery, it shows 'General' EditForm and all other forms are visible. My use case is user switches view as they want and when they're done they click on 'tick' button which uses Patch command across all forms. My formula is as below. My problem is Patch seems to clear all other forms that is not visible so I end up with some data not being saved. Have you encountered this?

 

Patch(
Table1,
MainGallery.Selected,HeaderForm.Updates
);

Patch(
Table2,
LookUp(Table2,
Key = Text(MainGallery.Selected.ID)),
Table2Form.Updates
);

Patch(
Table3,
LookUp(Table3,
Key2 = Text(MainGallery.Selected.ID)),Table3Form.Updates
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Patch function not saving all forms in my screen

If it is, set a global variable before you patch and use that instead of referring back to the galley.

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Patch function not saving all forms in my screen

Hi @iamlee,

Have you seen a pattern in which form isn’t saved? Is it completely random?

iamlee
Level 8

Re: Patch function not saving all forms in my screen

I couldn't pick a pattern yet, it seems random. The bizaare thing is I have 2 buttons, one is to save draft and one is to save it and promote the item (submit button) into the next status. The save draft works fine. The difference is the submit button calls Microsoft Flow to update the Status field and then navigates back to the home screen. 

 

I then eliminated the Microsoft Flow function, and it's still the same. 

iamlee
Level 8

Re: Patch function not saving all forms in my screen

I think I have found a pattern. I actually have a header form, and all the others are item form. I then only have 1 gallery which is the headerform. In order to display the other forms upon selection, I do a look-up based on the selected item in the gallery. I think after Patch I lose the selection from the gallery and thus succeeding Patch command fails. 

 

plausible theory?

Super User
Super User

Re: Patch function not saving all forms in my screen

If it is, set a global variable before you patch and use that instead of referring back to the galley.

View solution in original post

iamlee
Level 8

Re: Patch function not saving all forms in my screen

@Drrickryp it seems to have worked!!! What I did was OnVisible property of the screen, I set 'Key' of each item form as the ID of whatever item was selected in the Header Gallery. 

//SGID is the ID of the Form I want displayed//

Set(
SGID,
MainGallery.Selected.ID
);

//Lookup Item to be displayed//

On Item property of the SGForm, I did this:

LookUp(SGTable,SGKey = Text(SGID))

 

The HeaderForm still 'blanks out' after patch (blank out meaning powerapps will show 'No Item To Display'.  I'm analyzing a bit further but I think it was indeed the Patch function resetting the selected items in my gallery. 

 

Thanks!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,173)