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 / ForAll and Patch Funct...
Power Apps
Answered

ForAll and Patch Function – New Forms

(0) ShareShare
ReportReport
Posted on by 78

Hi, I am trying to create a button with a new form, that when pressed, does the following:

 

  • Uploads the data within the form to my datasource, and
  • Searches through the datasource for all records with same Reference, and updates all of the records for the date value included in the form.

 

 

The first point is simple but I am looking for help with the 2nd point. I think I have to use the ‘ForAll’ and ‘Patch’ function, but I am struggling to do this.

 

My datasource is called PropertyDatabase and is a SQL database

The reference field is called Property_Reference

The date field is called Disposal Date

 

Thanks

Categories:
I have the same question (0)
  • Verified answer
    SimnaJ Profile Picture
    205 on at

    To update all records in your SQL database that have the same reference as the one entered in your form, you can use the ForAll and Patch functions in Power Apps. Here is an example formula that you can use for your button:

    ForAll(
     Filter(PropertyDatabase, Property_Reference = Form1.LastSubmit.Property_Reference),
     Patch(
     PropertyDatabase,
     ThisRecord,
     {
     'Disposal Date': Form1.LastSubmit.'Disposal Date'
     }
     )
    )

    In this formula, we are using the Filter function to filter the PropertyDatabase based on the Property_Reference field that matches the value entered in the form (Form1.LastSubmit.Property_Reference). We then use the ForAll function to loop through each record in the filtered data source and use the Patch function to update the 'Disposal Date' field with the value entered in the form (Form1.LastSubmit.'Disposal Date').

    Please replace "Form1" with the name of your form and adjust the field names in the formula based on your specific table/column names.

    This formula assumes that the data source PropertyDatabase has already been connected to your app. If it hasn't been connected yet, please add the connection and the relevant table to your app.

     

     

    If my answer was helpful in solving your issue, please consider marking it as the solution by clicking the 'Mark as solution'. Thank You!!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 547

#2
WarrenBelz Profile Picture

WarrenBelz 444 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard