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 / Combining bulk update ...
Power Apps
Unanswered

Combining bulk update with "with" function possible?

(0) ShareShare
ReportReport
Posted on by 711

I would like to update several columns in a collection based on a record I need to lookup.

If I would lookup that record for every column it would be slow.

I would like to do something like

UpdateIf(

               Mycollection

               ,true

               ,With( 

                         {MyRec:Lookup(etc..)}

                         {

                          col1:MyRec.Field1

                          ,col2:MyRec.Field2

                         }

                 )

The compiler sees this code as invalid.

If I use ForAll the compiler thinks it's ok and it works but all other column values in the collection are lost.

Probably simple but just don't see it right now.

 

 

 

Categories:
I have the same question (0)
  • Adrian_Celis Profile Picture
    1,652 Moderator on at

    Hi @HansHeintz 

    You should have your 'With' formula outside of the 'UpdateIf'. Try this:

    With({MyRec:LookUp(etc...)},
    UpdateIf(MyCollection,true,
    {Title: MyRec.Field1,
    test1: MyRec.Field2})
    )

     

  • HansHeintz Profile Picture
    711 on at

    So in your example MyRec evaluates different for each item of MyCollection?

  • Adrian_Celis Profile Picture
    1,652 Moderator on at

    Hi @HansHeintz 

    Oh, so MyRec is different for each item in MyCollection?

    And does your MyCollection has an ID column?

    If so, you can use ForAll + AddColumns first to map out your MyRec first, then do the UpdateIf. Something like:

     

    ForAll(AddColumns(MyCollection,"myRec",LookUp(...)) As ActiveRecord,
    UpdateIf(MyCollection,ID = ActiveRecord.ID,
    {col1:ActiveRecord.myRec.Field1,
    col2:ActiveRecord.myRec.Field2
    }
    ));

     

    I'm not sure if this is better or worse, but this is the alternative I can think of.

  • HansHeintz Profile Picture
    711 on at

    I have extensively used the adding of a record to the column of a collection but i find that powersapps randomly looses some columns of this record. If I try to retrieve the value of a field of this record in the app it is Blank() while in the original record it is not. Actually my first question stems from my frustrations of using the implementing a record in the collection method 😉

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard