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 UpdateIf al...
Power Apps
Answered

ForAll and UpdateIf alias/conditions

(0) ShareShare
ReportReport
Posted on by 134

I've been reading about/trying this all day, and have just given up and need someone to help figure out what i'm doing wrong.  Using an Azure SQL database when talking about tables

 

The process-

 

Step 1: User selects records from recordTable into a collection (colRecords).  This works

Step 2: User fills out a form and submits it to summaryTable (basically sums up the records + some user input).  During this varSummaryID is populated and stored in a variable.  This also works.

Step 3: OnSuccess of the submitted form, I need to update the recordTable, which has a column called "SummaryID".  I have gotten this to either not work at all, or to update EVERY record in the table (100k ish records...well it tried to.  I caught it and killed it).

 

If this were SQL the final step would be

 

UPDATE recordTable

SET SummaryID = 'SummaryIDGoesHere'

WHERE recordTable.ID IN colRecords.ID

 

Obviously not a real statement, but just trying to get the idea across.

 

My attempt-

 

 

ForAll(
 colRecords,
 UpdateIf(
 recordTable,
 recordTable.ID = colRecords.ID,
 {Stuff to update}
 )
)

 

My issue is the condition logic- recordTable.ID = colRecords.ID

This variation will not work as you can't alias like this (recordTable.ID/colRecords.Id). 

Trying:

ID = ThisRecord.ID:  is what led to the "update everything" scenario, so i assume that's just it saying ThisRecord.ID = ThisRecord.ID

 

I've also messed with patching and lookups, but 90% of the questions on this relate to other issues. My problem here is that i'm taking the starting table, getting ID's from it, then trying to update that table for every ID selected, and yet I can't seem to get it to reference the right thing.

 

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

    Finally found a video that helped.  Final code-

     

    ForAll(
     RenameColumns(colRecords,"recordID","TestID"),
     UpdateIf(
     'recordTable',
     'recordTable'[@recordID] = TestID ,
     {SummaryID:varSummaryID}
     )
    )

     

    As i suspected it was just an aliasing issue, and i'd totally forgotten about rename columns.

     

    It drives me crazy how many little edge cases like this exist, where the product is ALMOST there, but I wind up stuck replicating basic functionality, and you wind up wading into syntax/expectation hell.

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

Last 30 days Overall leaderboard