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 / Collection for FirstN ...
Power Apps
Unanswered

Collection for FirstN UpdateIf For input Value

(0) ShareShare
ReportReport
Posted on by 6

Hai, need help… I’m create collection where auto generate 14 rows. Since that cannot merge row for text input “location” such as from row 1 to row 7, how can i auto populate text input when user insert text value in “location” from row 1 until row 7 will be same value? This I’m stuck on this one.

 

photo_6174701772690537349_y.jpg

Categories:
  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @Aliah ,

    Assuming you have the ID of the item in the collection (if not use whatever unique identifier you have)

    With(
     {
     _Data: 
     FirstN(
     colPDR1Red7,
     7
     )
     },
     ForAll(
     _Data As _D,
     Patch(
     colPDR1Red7,
     LookUp(
     colPDR1Red7,
     ID = _D.ID
     ),
     {Memory: Self.Text}
     )
     )
    )

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Aliah Profile Picture
    6 on at

    Thank you. First time using With function. At first I using UpdateIf coded ID one by one.

  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @Aliah ,

    It is a bit of a sneaky workaround as you cannot update a data source with itself (you will get an error if you try), however With() effectively creates a "ghost copy" of the data you want to Patch and then the ForAll loops through this copy and updates the matching record in the "real" data source.

  • Aliah Profile Picture
    6 on at

    I try to implement same way if ID =1 until ID =7 same text input value & another ID=8 until ID 14 same text input value. I'm not sure is correct or not:

     

    With(
     {
     Data_Red: 
     FirstN(
     colPDR1Red,
     7
     )
     },
     ForAll(
     Data_Red As _D,
     Patch(
     colPDR1Red,
     LookUp(
     colPDR1Red,
     ItemNo = _D.ItemNo
     ),
     {Location: Value(Self.Text)
     }
     )
     )
    );
    
    With(
     {
     Data_Red1: 
     LastN(
     colPDR1Red,
     7
     )
     },
     ForAll(
     Data_Red1 As _D1,
     Patch(
     colPDR1Red,
     LookUp(
     colPDR1Red,
     ItemNo = _D1.ItemNo
     ),
     {Location: Value(Self.Text)
     }
     )
     )
    );
  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    @Aliah ,

    Why bother doing 2 patches - just patch the first 14. I also assume here that ItemNo is a numeric column and is unique for each record.

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
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard