cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hsy
Helper I
Helper I

Is there a way to update another table based on an existing table?

Hello everyone,

 

If we have the following table

CustomerEmail
Customer AcustA@email.com
Customer BcustB@email.com
Customer CcustC@email.com

 

And an updated Customer table 

CustomerEmail
Customer BcustB2@email.com
Customer CcustC2@email.com

 

Is there a way to loop through the second table then update the first table?

CustomerEmail
Customer AcustA@email.com
Customer BcustB2@email.com
Customer CcustC2@email.com
1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @hsy :

I assume there are two tables:

 

ClearCollect(
 TargetTable,
 {Customer:"CustomerA",Email:"custA@email.com"},
 {Customer:"CustomerB",Email:"custB@email.com"},
 {Customer:"CustomerC",Email:"custC@email.com"}
);
ClearCollect(
 CustomerTable,
 {Customer:"CustomerB",Email:"custB2@email.com"},
 {Customer:"CustomerC",Email:"custC2@email.com"}
)

 

Please try:

 

ForAll(
    CustomerTable,
    Patch(
        TargetTable,
        LookUp(
            TargetTable,
            TargetTable[@Customer] = CustomerTable[@Customer]
        ),
        {Email: CustomerTable[@Email]}
    )
)

3.gif

 

Best Regards,

Bof

View solution in original post

2 REPLIES 2
hsy
Helper I
Helper I

Patch function in Power Apps - Power Apps | Microsoft Docs
I found this - Modify or create a set of records in a data source

Not yet found any example though, keep digging....

v-bofeng-msft
Community Support
Community Support

Hi @hsy :

I assume there are two tables:

 

ClearCollect(
 TargetTable,
 {Customer:"CustomerA",Email:"custA@email.com"},
 {Customer:"CustomerB",Email:"custB@email.com"},
 {Customer:"CustomerC",Email:"custC@email.com"}
);
ClearCollect(
 CustomerTable,
 {Customer:"CustomerB",Email:"custB2@email.com"},
 {Customer:"CustomerC",Email:"custC2@email.com"}
)

 

Please try:

 

ForAll(
    CustomerTable,
    Patch(
        TargetTable,
        LookUp(
            TargetTable,
            TargetTable[@Customer] = CustomerTable[@Customer]
        ),
        {Email: CustomerTable[@Email]}
    )
)

3.gif

 

Best Regards,

Bof

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,204)