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 / Power Apps: ForAll wit...
Power Apps
Answered

Power Apps: ForAll with Patch Updates Only First Record and Ignores Filters

(0) ShareShare
ReportReport
Posted on by 2
Hi, I'm trying to update multiple rows in an Excel Online table using Power Apps, but I'm facing issues where only the first record gets updated, and the date filters seem to be ignored.
 

Objective:

  1. Filter Data: Collect records from the Capacity_dataset where:
    • I compare it against two selected values (DateFrom.Selected.Value and DateTo.Selected.Value).
  2. Further Filter: Filter the results by the selected Operation.
  3. Final Collection: Create a collection FilteredTableFinal containing records from the original Capacity_dataset where the Entry_ID matches the filtered results.
  4. Update Excel: Use a ForAll loop with Patch to update the OEE_Adjusted field for all matching rows in the Capacity_dataset.

Code I'm Using:

// Step 1: Filter and Collect Data
ClearCollect(
    FilteredTable,
    Filter(
        Capacity_dataset,
        Value(Year_Month) >= Value(DateFrom.Selected.Value) &&
        Value(Year_Month) <= Value(DateTo.Selected.Value)
    )
);

ClearCollect(
    FilteredTable1,
    Filter(
        FilteredTable,
        Operation = SelectOperation.Selected.Value
    )
);

ClearCollect(
    FilteredTableFinal,
    Filter(
        Capacity_dataset,
        Entry_ID in FilteredTable1.Entry_ID
    )
);

// Step 2: Update Data Using Patch
ForAll(
    FilteredTableFinal,
    Patch(
        Capacity_dataset,
        ThisRecord,  // Attempting to update the filtered records
        { OEE_Adjusted: Value(TextInput1.Text) }
    )
)
 

The Issues I'm Facing:

  1. Only the First Record is Updated:
    • Despite filtering correctly, only the first available row matching the Operation gets updated.
  2. Date Filters Ignored:
    • The update seems to ignore the date range (DateFrom and DateTo) completely.
  3. Wrong Placement of Data:
    • The updated value gets placed in the first available row with the selected Operation, not the correctly filtered rows.

What I Need Help With:

  • Why does the Patch function only update the first record and ignore the filtered data?
  • How can I ensure all filtered rows are updated correctly in Excel Online using Power Apps?
  • Is there a known limitation with the Excel connector when using ForAll and Patch together?
  • Any insights into whether ThisRecord loses connection to the original data source after filtering?
Capture.PNG
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,373 Most Valuable Professional on at
    Firstly try this - I cannot see your data, so cannot comment on the Filter results (I assume that Year_Month is a date value)
    With(
       {
          _List:
          Filter(
             Capacity_dataset,
             Operation = SelectOperation.Selected.Value &&
             Value(Year_Month) >= Value(DateFrom.Selected.Value) &&
             Value(Year_Month) <= Value(DateTo.Selected.Value)
          )
       },
       ForAll(
          _List As _Data,
          Patch(
             Capacity_dataset,
             LookUp(
                Capacity_dataset,
                Entry_ID = _Data.Entry_ID
             ),
             {OEE_Adjusted: Value(TextInput1.Text)}
          )
       )
    )
    Also note that if your dataset is above your Data Row Limit, Excel filtering can be inconsistent in the returned results.
     
    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    LinkedIn    Buy me a coffee

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard