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 / Submit Button Patch is...
Power Apps
Suggested Answer

Submit Button Patch is Uploading All Rather than One

(0) ShareShare
ReportReport
Posted on by 5,345 Moderator
I have Gallery_1.

Gallery_1 is displaying project data contained in a Collection.

In Gallery_1 I have a submit button with the following formula.

When I click the Gallery_1 submit button the Patch is uploading all items in the gallery rather than the item in-which the button resides.

The first 11 lines of the Patch (stopping at Waste Unit) are job related activities in a second gallery. A job could have one to multiple
activities. Location through the rest are in Gallery_1. The Project and all associated activities should upload. Currently, the Patch is
uploading ALL of the projects in the gallery and their activities.

Gallery_1 Submit button formula -
 
Categories:
  • ronaldwalcott Profile Picture
    3,914 Moderator on at
    What is the base record and change record in this Patch statement? Something seems to be missing.
  • WarrenBelz Profile Picture
    156,736 Most Valuable Professional on at
    It is because you are asking it to do exactly that with
    ForAll(colPendingStormWaterData . . 
    If you just want the current record updated and you are running the icon from inside the gallery, use
    ThisItem
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     
  • Phineas Profile Picture
    5,345 Moderator on at
    So.,

    Replace this -
     
       If(JPU_Job_Type_Dropdown.Selected.Value = "Storm Work",
          Patch(Storm_Work_List,
            ForAll(colPendingStormWorkData,
            {
     
    With this? -
     
       If(JPU_Job_Type_Dropdown.Selected.Value = "Storm Work",
          Patch(Storm_Work_List,
            ThisItem,
            {
  • WarrenBelz Profile Picture
    156,736 Most Valuable Professional on at
    Yes - have you tested it ? 
  • Phineas Profile Picture
    5,345 Moderator on at
    When I change to the following Power Apps kicks back errors on all the fields. Each on has the following errors.

         Error message: The type of this argument 'Activity' does not match the expected type 'Text'
         Error message: Name isn't valid. 'colPending...' isn't recognized.
  • Suggested answer
    ronaldwalcott Profile Picture
    3,914 Moderator on at
    Try replacing ThisItem with something like 
     
    LookUp('Storm_Work_List', key_value = Gallery1.SelectedItem.key_value)
     
    I am assuming that you want to update the related data in Storm_Work_List represented by the selected item of the collection that you are navigating in Gallery1.
    Key_value needs to be replaced with the identifying column in Storm_Work_List and the collection
     
  • WarrenBelz Profile Picture
    156,736 Most Valuable Professional on at
    You can run with what ronaldwalcott  has posted on the first part - if you still have errors, then what you originally posted should not have worked. What type of data are all the fields starting with col_pending and where exactly (button/location) are you running this from ?
  • Phineas Profile Picture
    5,345 Moderator on at
    The screen in question is shown below.

    The submit button is within the gallery.

    There is a Job gallery and an Activities gallery.
     
    The associated images are shown in a third gallery on another screen.

    The Job information that appears in the gallery is based on the dropdown
    controls.

    If only the Job type is selected, all Jobs saved to the device/collection are shown.
    If the Location is selected, all Jobs associated with that Location are shown.
    If the Work Order No. is selected, only the Job associated with the Work Order
    is shown.

    A Job can have one or multiple Activities.

    Regardless of dropdowns selected, when clicking the submit button, the Patch
    formula should upload ONLY the Job and associated activities and images.

    All of the above is occurring.

    This issue, when there is more than one Job all of the Jobs are being uploaded,
    rather than just the one Job in the template where the submit button is located.

     
     
    //No Connection Save Install Add Trip Data to Device
       If(JPU_Job_Type_Dropdown.Selected.Value = "Storm Work",
          Patch(Storm_Work_List,
           ForAll(colPendingStormWorkData,
           {    
             Activity: colPending_Activity,
             Activity_Rate: colPending_Activity_Rate,
             Activity_Unit: colPending_Activity_Unit,
             Activity_Quantity: colPending_Activity_Quantity,
             Activity_Total: colPending_Activity_Total,
             Consumed_Unit: colPending_Consumable_Unit,
             Consumed_Qty: colPending_Consumed_Qty,
             Consumed_Description: colPending_Consumable_Description,
             Waste_Qty: Value(colPending_Waste_Qty),
             Waste_Description: colPending_Waste_Description,
             Waste_Unit: colPending_Waste_Unit,
             Location: colPending_Location,
             Technician_Name: colPending_Technician_Name,
             Technician_ID_Number: colPending_Technician_ID_Number,
             Customer_Name: colPending_Customer_Name,
             Customer_Account_Number: colPending_Customer_Account_Number,
             Job_Hazard_Analysis_Number: colPending_Job_Hazard_Analysis_Number,
             Customer_Address: colPending_Customer_Address,
             Bill_To: colPending_Bill_To,
             Tap: colPending_Light_Level_Tap,
             Tap_Pole_Number: colPending_Tap_Pole_Number,
             Light_Level_at_NID: colPending_Light_Level_NID,
             Invoice_Type: colPending_Invoice_Type,
             Title: colPending_Title,
             Substation: colPending_Substation,
             Assy_Unit_or_Stock_Number: colPending_Assy_Unit_or_Stock_Number,
             Work_Date: colPending_Work_Date,
             Week_Ending_Date: colPending_Week_Ending_Date,
             Role: colPending_Role,
             Activity_Comments: colPending_Comments
           }
          )
        )
    );
     
    If(JPU_Job_Type_Dropdown.Selected.Value = "Storm Work",
        ForAll(
            JIPU_Images_Gallery.AllItems,
        UploadStormWorkJobImageFlow.Run(JIPU_Location_Fld.Text,
        JIPU_Image_Description_Fld.Text,
        JIPU_Company_Name_Fld.Text,
        JIPU_Work_Order_No_Fld.Text,
        JIPU_Job_Type_Fld.Text,
        JIPU_Work_Date_Fld.Text,
        {
            file: {
                contentBytes: JIPU_Image.Image,
                name:  JIPU_Location_Fld.Text & " - " &  JIPU_Job_Type_Fld.Text &" - "& JIPU_Image_Description_Fld.Text & " - " & JIPU_Company_Name_Fld.Text &" - "& JIPU_Work_Order_No_Fld.Text &" - "&  JIPU_Work_Date_Fld.Text & ".jpg"
            }
        }
       )
      )
    );
  • WarrenBelz Profile Picture
    156,736 Most Valuable Professional on at
     I will leave you with ronaldwalcott - he may be better at deciphering your responses than I am.
  • Niranjanbabu Chakali Profile Picture
    23 on at

    Hi,

    Please update your formula as shown below. Use ThisItem inside the Patch function, and it should work correctly:

    If(JPU_Job_Type_Dropdown.Selected.Value = "Storm Work",
        Patch(Storm_Work_List,
            {
                Activity: ThisItem.colPending_Activity,
                Activity_Rate: ThisItem.colPending_Activity_Rate,
                ...
                ...
                ...
            }
        )
    )


    If this resolves your issue, please mark my response as solved.

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 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard