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

Patch all items gallery in SharePoint List

Dear all,

I have a gallery that display items from SharePoint list. In the gallery, user need to enter marks in textbox input for each item. After done enter the marks for each items gallery, user need to click save and the marks will be updated in SharePoint list column.

 

Marks.PNG

 

What I did on the OnSelect button:

ForAll(Gallery1.AllItems,
    Patch('List Name', LookUp('List Name', Mark = 0),
    {
        Mark : Value(TextInput3.Text)
    })); 

 

However after submit, the marks are not patched correctly. The submitted marks are 5,4,3,2,1 (correct) but it updates in the list 5,4,3,1,2. Can refer image below of the column in SharePoint list.

SP List.PNG

 

How can I solve this issue? The issue is the marks submitted are not updated in the right item/row.

 

Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @shabilass :

I'v made a test but did not encountered the problem you mentinoned.

1\My SPlist-FlightList

2\Gallery1-Items

FlightList

3\TextInput3-Default

ThisItem.Mark

4\Add a button and set it's OnSelect property to

ForAll(
    RenameColumns(Gallery1.AllItems, "ID", "IDD"),
    Patch(FlightList, LookUp(FlightList, ID = IDD && Mark = 0),
    {
        Mark: Value(TextInput3.Text)
    }));

91.gif

Best Regards,

Bof

View solution in original post

6 REPLIES 6
v-bofeng-msft
Community Support
Community Support

Hi @shabilass :

I think the ID can be used to locate the corresponding record waiting to be updated.

Please try this code:

 

ForAll(
    RenameColumns(Gallery1.AllItems,"ID","IDD"), /*Renamed to eliminate ambiguity*/
    Patch('List Name', LookUp('List Name', ID= IDD),
    {
        Mark : Value(TextInput3.Text)
    })); 

 

Best Regards,

Bof

Hi @v-bofeng-msft 

 

I have tried your suggestion but I added  &&  Mark = 0 on the lookup function, because for my case I have a few more "Mark" columns (Mark1, Mark2, Mark3) and only wanted to update that "Mark" column". I have tried below code, but it doesn't update anything in the column.

 

ForAll(
    RenameColumns(Gallery1.AllItems, "ID", "IDD"),
    Patch('List Name', LookUp('List Name', ID = IDD && Mark = 0),
    {
        Mark: Value(TextInput3.Text)
    }));

 

Hi @shabilass :

I'v made a test but did not encountered the problem you mentinoned.

1\My SPlist-FlightList

2\Gallery1-Items

FlightList

3\TextInput3-Default

ThisItem.Mark

4\Add a button and set it's OnSelect property to

ForAll(
    RenameColumns(Gallery1.AllItems, "ID", "IDD"),
    Patch(FlightList, LookUp(FlightList, ID = IDD && Mark = 0),
    {
        Mark: Value(TextInput3.Text)
    }));

91.gif

Best Regards,

Bof

View solution in original post

hi @v-bofeng-msft 

 

May I know what is type for your "Mark" column (single text or number)?

And the textbox input you used in the gallery is text or number?

Hi @shabilass :

Make is a number column

textbox is a textbox control,I only set its default property.

Best Regards,

Bof

Hi @v-bofeng-msft 

 

Thank you for your help! Really appreciate that. I recreate the screen and follow your instruction. It's working correctly. Thank you so much!

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,604)