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 / Gallery checkbox item ...
Power Apps
Answered

Gallery checkbox item related issue attached screenshots of the issue

(0) ShareShare
ReportReport
Posted on by 2,249

Below is my design and I am unable to patch properly in the context that

 

Queries:

1)when nothing got checked in the gallery items but then I click final update button then items are getting patched randomly . 

2) Need help on how to patch multiple selected items for the below gallery items

 

Veblitz_1-1671206273838.png

 

 

Veblitz_2-1671206371323.png

 

Veblitz_3-1671206484449.png

 

Veblitz_4-1671206539048.png

 

Veblitz_6-1671206906473.png

 

 

 

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Veblitz, if I understand it correctly you want to only patch the items that are checked.
    If none are checked, nothing should be patched. To achieve this we will have to adjust a few things:

    (1) OnCheck will add the item to a new collection:

     

    Collect(colSelectedShortList, ThisItem)

     

     

    (2) OnUnCheck will remove the item from the collection:

     

    Remove(colSelectedShortList, ThisItem)

     

     

    (3) The OnSelect of your button will be:

     

    //Each selected item in the collection will be updated
    ForAll(colSelectedShortList As Main,
    Patch(ShortListedRoster, LookUp(ShortListedRoster, ID = Main.ID),
    {Role: DropDown5.Selected.Value})
    )

     

    Note: If your gallery Items property is ShortListedRoster, your LookUp in the Patch is not needed. You could write the Patch as stated below by just using the record:

     

    //Change the Patch in the ForAll see above
    Patch(ShortListedRoster, Main, {Role: Dropdown5.Selected.Value})

     

     

    (4) You could add some sort of security / validation

    If(CountRows(colSelectedShortList) > 0,
    //Patch when at least one item is selected
    ForAll(colSelectedShortList As Main,
    Patch(ShortListedRoster, LookUp(ShortListedRoster, ID = Main.ID),
    {Role: DropDown5.Selected.Value})
    ),
    //Show error when nothing is selected
    Notify("Please select at least one item", NotificationType.Error, 5000)
    )

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

  • Veblitz Profile Picture
    2,249 on at

    Much appreciated.

     

    Please note gallery Items property is ShortListedRoster, I am facing errors in patch function

     

    Veblitz_1-1671283955044.png

     

     

  • Veblitz Profile Picture
    2,249 on at

    Please find the detailed errors

     

    Veblitz_2-1671284096682.png

     

  • LaurensM Profile Picture
    12,516 Moderator on at

    @Veblitz in the first screenshots, the field to patch was 'Role'.

    Could you swap SRroles for Role.

  • LaurensM Profile Picture
    12,516 Moderator on at

    If SRroles is a new field that was needed, try:

    SRroles: Dropdown3.Selected
    
    Or
    
    SRroles: {Value: Dropdown3.Selected.Value}
  • Veblitz Profile Picture
    2,249 on at

    Also, when I check and choose the dropdown values then it should patch the selected values to my patch function

     

    For example, if I check the gallery items then I choose backup from dropdown values next I click final update button then it should patch backup for the respective checked item from gallery,same way if I choose some other value from dropdown and check some items from gallery and when I select finalupdate button then it should patch the selected value from dropdown. 

  • LaurensM Profile Picture
    12,516 Moderator on at

    @Veblitz if SRroles is a choice field, the code below will fix the issue:

     

    SRroles: Dropdown3.Selected
    
    Or
    
    SRroles: {Value: Dropdown3.Selected.Value}

     


    After the patching (so after the ForAll but still in the true part of the if statement) you will also have to clear the collection:

    Clear(colSelectedShortList)

     

  • Veblitz Profile Picture
    2,249 on at

    Much appreciated.

    Sorry if there are any confusions caused by me and error is sorted .

    Unfortunately, patch function is not patching as per checked items from gallery lets say if I select 1 item and choose dropdown backup then my remaining items getting patched as Backup but I did not check remaining items in my gallery.So,as per my testing its patching bulk based on dropdown selected  even if we don't check any other gallery items.

     

    Note: gallery Items property is ShortListedRoster,

    Below is my patch function in the finalupdate onselect button

     

    Veblitz_2-1671289015274.png

     

     

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @Veblitz no worries! However, that functionality should not happen, only the ones in the colSelectedShortList should be updated.
    I retested this functionality and it works as expected. Could you do the following things:

    (1) Double check that the OnCheck and OnUnCheck have the code shown in the comments above

     

    (2) Change the ForAll statement, you currently have the Clear() in the false section (it should be in the true section) of the If statement:

    If(CountRows(colSelectedShortList) > 0,
    //Patch when at least one item is selected
    ForAll(colSelectedShortList As Main,
    Patch(ShortListedRoster, Main,
    {SRrole: DropDown3.Selected})
    );
    //Clear the function after the Patch 
    Clear(colSelectedShortList),
    //Show error when nothing is selected
    Notify("Please select at least one item", NotificationType.Error, 5000)
    )

     

    With the functionality above, all checked items will get updated with the selected dropdown value once your press the button. After this patch, the colSelected will be cleared and you can start fresh.

    I hope this helps!

  • Veblitz Profile Picture
    2,249 on at

    Fantastic solutions and awesome help.

     

    Thanks a ton 😎

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
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard