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 patch when ther...
Power Apps
Unanswered

forall patch when there is no ID record.

(0) ShareShare
ReportReport
Posted on by 236

Sorry for a long post - this solution is a little convoluted.

I am creating an app where a user needs to perform an inspection on an option which linked to an item, inside a room, in a building.

For example : Check that the floor (Item) is clean (option) in the kitchen (room) in building A

Each Item needs to be inspected at specific frequencies (either daily, weekly, monthly etc.)

 

The idea is that the user clicks the select the Building, then selects the Frequency before navigating to the Room/Item and then update the option.

 

In order to avoid creating hundreds of blank records (because the items are not due for inspection) in the BM_Check table, I do the following.

 

When the user selects the building, 2 collections are created in order to keep a record of the.

1. col_inspectionTemplate lists ALL items that could be inspected in the building (Based on a template / master view ) - There is no primary key (ID_Check) because (theoretically) the check has not been created yet.  I have added a field called ID_Chk and set to a default value of 1.

 

2. col_TodayChecks collects any actual inspections from BM_Check, for any that have already been recorded for today (if any)

 

Now if there are any records in col_TodayChecks, then I want to update the col_InspectionTemplate.ID_Check to the ID that is stored in col_TodayChecks.

 

The following code is finding only one record in col_InspectionTemplate (not necessarily a matching record) and updating it with the last record from col_TodayChecks.

 

 

ForAll(col_TodayChecks,
Patch(col_InspectTemplate,
First(Filter(col_InspectTemplate, ID_Item_To_Check exactin col_TodayChecks.ID_Item_To_Check And
ID_Room exactin col_TodayChecks.ID_Room And
ID_Check_Option exactin col_TodayChecks.ID_Check_Option)),
{ID_Chk: ID_Check})
);

 

 

 

I was hoping to set a variable/UpdateContext inside the ForAll loop so that I could debug where its going wrong - but apparently that is not permissible on PowerApps.

 

PS: BM_Check is patched in another process - depending on whether the record exists (for Today()) or not.

 

Any suggestions on how to make this work would be greatly appreciated.

Categories:
I have the same question (0)
  • MissingLink Profile Picture
    236 on at

    They say that a picture paints a 1000 words, so here are the 2 tables that I'm working with.

    col_InspectTemplate.pngcol_TodayChecks.png

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 545 Most Valuable Professional

#2
Haque Profile Picture

Haque 314

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard