web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / For All Patch LookUp f...
Power Apps
Unanswered

For All Patch LookUp formula , only changing 1 matched row

(0) ShareShare
ReportReport
Posted on by 102

 

This is my attempt , but it only changes 1 row , so if I have more than 1 row of data matched it does not change them

ForAll(Master_List,Patch(Master_Profiles,LookUp(Master_Profiles,Title=Master_List[@Title]),{field_16:Master_List[@ID]}))

Title = Code and field_16 is the account_id field

So I am looping through Master_List

So if ID =  1 it has code AX2 , I then want to update all the rows in Master_Profiles , with a matching code of AX2 , and add the ID number to the AccountID field in Master_Profiles.

Master_List

ID       Code

1         AX2

2         BYE

3         NJK

Master_Profiles has mulitple rows linked to the code as they are different types , so I need the account_id adding for all of them like the example below.

Code  Type AccountID  

AX2     A      1

AX2     B       not changed

BYE     A        2

NJK     A        3

NJK     B        not changed

NJK     C        not changed

Categories:
I have the same question (0)
  • JD_26 Profile Picture
    102 on at
    Re: Copy Sharepoint List ID from one database to another looping through all rows

    I tested the code and it only amends one row , so if there are more than 1 matched code they dont get changed , is there a way to fix this please

  • v-xiaochen-msft Profile Picture
    on at
    Re: For All Patch LookUp formula , only changing 1 matched row

    Hi @JD_26 ,

     

    I made a sample for you.

    vxiaochenmsft_1-1673920920036.png

    vxiaochenmsft_3-1673921548236.png

    vxiaochenmsft_4-1673921562241.png

    ForAll(Master_List, ForAll(Filter(Master_Profiles,Code=Master_List[@Code]) As temp ,Patch(Master_Profiles,temp,{AccountID:Master_List[@ID]})))

    vxiaochenmsft_5-1673921582576.png

     

    Best Regards,

    Wearsky

  • JD_26 Profile Picture
    102 on at
    Re: For All Patch LookUp formula , only changing 1 matched row

    Thankyou for taking time to look at this solution , I tried your code but it shows an error which says this function cannot operate on the same data source that is used ForAll

    This is my code , Title field is where the codes are stored and field_16 is the account_id

    ForAll(Master_List, ForAll(Filter(Master_Profiles,Title=Master_List[@Title]) As temp,Patch(Master_Profiles,temp,{field_16:Master_List[@ID]})))

  • v-xiaochen-msft Profile Picture
    on at
    Re: For All Patch LookUp formula , only changing 1 matched row

    Hi @JD_26 ,

     

    I can't reproduce the error.

     

    Best Regards,

    Wearsky

  • v-xiaochen-msft Profile Picture
    on at
    Re: For All Patch LookUp formula , only changing 1 matched row

    Hi @JD_26 ,

     

    Please try this:

    ForAll(Master_List, ForAll(DropColumns(AddColumns( Filter(Master_Profiles,Title=Master_List[@Title]),"Col",1),"Col") As temp,Patch(Master_Profiles,temp,{field_16:Master_List[@ID]})))

     

    Best Regards,

    Wearsky

  • JD_26 Profile Picture
    102 on at
    Re: For All Patch LookUp formula , only changing 1 matched row

    Thankyou that fixed the issue and the code is working correctly , could you please explain what this additional part of the code is doing please , 

    "Col",1),"Col")

     

  • Verified answer
    v-xiaochen-msft Profile Picture
    on at
    Re: For All Patch LookUp formula , only changing 1 matched row

    Hi @JD_26 ,

     

    It just creates a temporary table, and it can help to replace the data source to avoid error.

     

    Best Regards,

    Wearsky

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard