cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate IV
Advocate IV

Patch statements not updating all fields

I have a screen with 18 text input boxes. I cannot use a form due to the design for the scrren, so I created 18 patch statements as follows:

 

Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{ItemSetupWidth: Value(txtItemSetupWidth.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{ItemSetupDepth: Value(txtItemSetupDepth.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{ItemSetupHeight: Value(txtItemSetupHeight.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{ItemSetupWeight: Value(txtItemSetupWeight.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{SellingUnitWidth: Value(txtItemSellingUnitWidth.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{SellingUnitDepth: Value(txtItemSellingUnitDepth.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{SellingUnitHeight: Value(txtItemSellingUnitHeight.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{SellingUnitWeight: Value(txtItemSellingUnitWeight.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{InnerCartonWidth: Value(txtItemInnerCartonWidth.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{InnerCartonDepth: Value(txtItemInnerCartonDepth.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{InnerCartonHeight: Value(txtItemInnerCartonHeight.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{InnerCartonWeight: Value(txtItemInnerCartonWeight.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{InnerCartonCasePackQuantity: Value(txtItemInnerCartonQtyPer.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{OuterCartonWidth: Value(txtItemOuterCartonWidth.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{OuterCartonDepth: Value(txtItemOuterCartonDepth.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{OuterCartonHeight: Value(txtItemOuterCartonHeight.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{OuterCartonWeight: Value(txtItemOuterCartonWeight.Text)});
Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{CasePackQuantity: Value(txtItemOuterCartonQtyPer.Text)});
Navigate(scrMainScreen,Transition.None)

 

 

If there is a better way to do that, let me know, but that isn't my problem. When I press "Submit" which is where the above code is, only the first 6-8 fields get written back to the SQL table. I can verify this on the SQL server. 

But, if I navigate back to that screen, all fields are populated. Each field has the following formula:

 

If(gvarEditMode = "Edit", galItemSelection.Selected.ItemSetupWidth,"")

 

So the values the user inputs are still in memory, and the fields populate. If I make no changes, and hit Submit again, another 4-8 fields get written to the SQL server. Do it again and they finally all get written.

It is like it is timing out so partially gives up. 

 

I don't think this is relevant as they all do get written, but the GUI is inconsistent for these Patch statements. Notice how the items in the red box are not purple? Those are valid text boxes, and I used the AutoComplete to fill that in. Just tossing this in in case it is relevent. My main concern is I want all 18 PATCH() statements to happen when I press Submit.

2020-04-30 07_53_23-Item Development - Saved (Unpublished) - Power Apps and 8 more pages - Work 3 - .png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Patch statements not updating all fields

You don't need 18 patch statements, you need one patch statement with 18 fields.  Something like this:

Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{ItemSetupWidth: Value(txtItemSetupWidth.Text)
,{ItemSetupDepth: Value(txtItemSetupDepth.Text)
,{ItemSetupHeight: Value(txtItemSetupHeight.Text)
,{ItemSetupWeight: Value(txtItemSetupWeight.Text)
,{SellingUnitWidth: Value(txtItemSellingUnitWidth.Text)
,{SellingUnitDepth: Value(txtItemSellingUnitDepth.Text)
,{SellingUnitHeight: Value(txtItemSellingUnitHeight.Text)
,{SellingUnitWeight: Value(txtItemSellingUnitWeight.Text)
,{InnerCartonWidth: Value(txtItemInnerCartonWidth.Text)
,{InnerCartonDepth: Value(txtItemInnerCartonDepth.Text)
,{InnerCartonHeight: Value(txtItemInnerCartonHeight.Text)
,{InnerCartonWeight: Value(txtItemInnerCartonWeight.Text)
,{InnerCartonCasePackQuantity: Value(txtItemInnerCartonQtyPer.Text)
,{OuterCartonWidth: Value(txtItemOuterCartonWidth.Text)
,{OuterCartonDepth: Value(txtItemOuterCartonDepth.Text)
,{OuterCartonHeight: Value(txtItemOuterCartonHeight.Text)
,{OuterCartonWeight: Value(txtItemOuterCartonWeight.Text)
,{CasePackQuantity: Value(txtItemOuterCartonQtyPer.Text)});
Navigate(scrMainScreen,Transition.None)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Highlighted
Dual Super User
Dual Super User

Re: Patch statements not updating all fields

You don't need 18 patch statements, you need one patch statement with 18 fields.  Something like this:

Patch('[dbo].[tblAppItemDevelopment]',galItemSelection.Selected,{ItemSetupWidth: Value(txtItemSetupWidth.Text)
,{ItemSetupDepth: Value(txtItemSetupDepth.Text)
,{ItemSetupHeight: Value(txtItemSetupHeight.Text)
,{ItemSetupWeight: Value(txtItemSetupWeight.Text)
,{SellingUnitWidth: Value(txtItemSellingUnitWidth.Text)
,{SellingUnitDepth: Value(txtItemSellingUnitDepth.Text)
,{SellingUnitHeight: Value(txtItemSellingUnitHeight.Text)
,{SellingUnitWeight: Value(txtItemSellingUnitWeight.Text)
,{InnerCartonWidth: Value(txtItemInnerCartonWidth.Text)
,{InnerCartonDepth: Value(txtItemInnerCartonDepth.Text)
,{InnerCartonHeight: Value(txtItemInnerCartonHeight.Text)
,{InnerCartonWeight: Value(txtItemInnerCartonWeight.Text)
,{InnerCartonCasePackQuantity: Value(txtItemInnerCartonQtyPer.Text)
,{OuterCartonWidth: Value(txtItemOuterCartonWidth.Text)
,{OuterCartonDepth: Value(txtItemOuterCartonDepth.Text)
,{OuterCartonHeight: Value(txtItemOuterCartonHeight.Text)
,{OuterCartonWeight: Value(txtItemOuterCartonWeight.Text)
,{CasePackQuantity: Value(txtItemOuterCartonQtyPer.Text)});
Navigate(scrMainScreen,Transition.None)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Advocate IV
Advocate IV

Re: Patch statements not updating all fields

Beautiful. Let me come back to this at lunch. I'll mark as solution once verified.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,926)