web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch statements not u...
Power Apps
Answered

Patch statements not updating all fields

(0) ShareShare
ReportReport
Posted on by 386

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

Categories:
  • Verified answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    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)
  • EdHansberry Profile Picture
    386 on at

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard