cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gana_Dube
Helper II
Helper II

How to LookUp and Patch more than one row in Lists

Hi,

 

I have the following code which updates the records in the SharePoint List, however I am not sure how to correctly perform the Lookup on the second row and update the columns.

 

Patch(
dataRecordSet ,
LookUp(dataRecordSet,Title=1),
    {
        input_1: Checkbox_1.Value,
        input_3: Radio_button_1.Selected.Value
    },
LookUp(dataRecordSet,Title=2),
    {
        input_1: Checkbox_3.Value,
        input_4: Radio_button_4.Selected.Value
    }
);

 

Gana_Dube_1-1669880866781.png

From the code, if you remove the second LookUp, the update to the records work

 

// This works
Patch(
dataRecordSet ,
LookUp(dataRecordSet,Title=1),
    {
        input_1: Checkbox_1.Value,
        input_3: Radio_button_1.Selected.Value
    }
);

 

Another thing I am facing on the first code with the additional lookup is the Error message: The specified column is read-only and can't be modified

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Gana_Dube ,

 

Maybe you could try:

 

Patch(
  dataRecordSet ,
  Filter(dataRecordSet,Title=1||Title=2),
   Table(
    {
        input_1: Checkbox_1.Value,
        input_3: Radio_button_1.Selected.Value
    },
    {
        input_1: Checkbox_3.Value,
        input_4: Radio_button_4.Selected.Value
    }
   )
);

 

vbofengmsft_0-1669882102309.png

I think this link will help you a lot:

https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-patch#modify-or-create-...

 

In addition, If you need to update multiple records, we recommend that you use the patch multiple times.

 

Please try:

 

Patch(
dataRecordSet ,
LookUp(dataRecordSet,Title=1),
    {
        input_1: Checkbox_1.Value,
        input_3: Radio_button_1.Selected.Value
    }
);
Patch(
dataRecordSet ,
 LookUp(dataRecordSet,Title=2),
    {
        input_1: Checkbox_3.Value,
        input_4: Radio_button_4.Selected.Value
    }
);

 

Best Regards,

Bof

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @Gana_Dube ,

 

Maybe you could try:

 

Patch(
  dataRecordSet ,
  Filter(dataRecordSet,Title=1||Title=2),
   Table(
    {
        input_1: Checkbox_1.Value,
        input_3: Radio_button_1.Selected.Value
    },
    {
        input_1: Checkbox_3.Value,
        input_4: Radio_button_4.Selected.Value
    }
   )
);

 

vbofengmsft_0-1669882102309.png

I think this link will help you a lot:

https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-patch#modify-or-create-...

 

In addition, If you need to update multiple records, we recommend that you use the patch multiple times.

 

Please try:

 

Patch(
dataRecordSet ,
LookUp(dataRecordSet,Title=1),
    {
        input_1: Checkbox_1.Value,
        input_3: Radio_button_1.Selected.Value
    }
);
Patch(
dataRecordSet ,
 LookUp(dataRecordSet,Title=2),
    {
        input_1: Checkbox_3.Value,
        input_4: Radio_button_4.Selected.Value
    }
);

 

Best Regards,

Bof

Gana_Dube
Helper II
Helper II

@v-bofeng-msft Thank you very much, your method worked exceptionally, and the guidance on the error is well understood. Great feedback and support 👍.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,377)