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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Powerapps CheckBox All...
Power Apps
Answered

Powerapps CheckBox All should uncheck if one of the checkbox is unchecked.

(0) ShareShare
ReportReport
Posted on by 5

Hi Team,

 

Please guide me on this issue. There are checkboxes in gallery and outside of it I have given a checkbox ALL which, if checked, will check all the checkboxes inside gallery and vice versa. If the outside check box is checked, I am adding all the items to a collection and then the further processing starts on click of a button. Now, the issue is, if the user checks the ALL and then decides to uncheck one of the item, the click on submit button is still taking all the items. I have used remove function under uncheck property of gallery item but the collection still takes all the items. Can I do something like, when the user decides to uncheck one checkbox, the checkbox ALL also gets unchecked and only the checked ones come into collection

Categories:
I have the same question (0)
  • Ramanachiappan Profile Picture
    179 Moderator on at

    Try this one @Meghna_Jain ,

    Common CheckBox:

    1. OnCheck:

    ClearCollect([TempYourCollection],[YourCollection])
    ForAll([TempYourCollection] As Record,
    Patch([YourCollection],LookUp([YourCollection],ID = Record.ID),{[YourCheckBoxColumnName]:true})
    )

    1. OnUnCheck:

    ClearCollect([TempYourCollection],[YourCollection])
    ForAll([TempYourCollection] As Record,
    Patch([YourCollection],LookUp([YourCollection],ID = Record.ID),{[YourCheckBoxColumnName]:false})
    )

    Gallery CheckBox:

    1. OnCheck:

    Patch([YourCollection],LookUp([YourCollection],ID = ThisItem.ID),{[YourCheckBoxColumnName]:true})

    1. OnUnCheck:

    Patch([YourCollection],LookUp([YourCollection],ID = ThisItem.ID),{[YourCheckBoxColumnName]:false})

    Note:
    Please consider marking my post as the solution by clicking "Accept" if it assisted you in resolving your issue. This action will make it easier for others to find the solution and will close the item. If you found the content helpful in other respects, please consider giving it a thumbs up.

  • Verified answer
    v-yueyun-msft Profile Picture
    on at

    Hi , @Meghna_Jain 

     I test it in my side , you can refer to this:

    vyueyunmsft_0-1711958661933.png

    You need to use the ClearCollect() function to add a column like this:

    ClearCollect(Products2 , AddColumns(CustomGallerySample,"IsChoosen",false))
     
    CustomGallerySample is my test Table Name
    vyueyunmsft_1-1711958724507.png

     

    The check box in Gallery.

    OnCheck:

    Patch(Products2,ThisItem,{IsChoosen:true})
    OnUnCheck:
    Patch(Products2,ThisItem,{IsChoosen:false})
    Default:
    ThisItem.IsChoosen
     
    The All Checkbox outside of Gallery.

    OnCheck:

    UpdateIf(Products2 , true , {IsChoosen:true})
    OnUnCheck:
    UpdateIf(Products2 , true , {IsChoosen:false})
    Default:
    CountIf(Products2,IsChoosen) = CountRows(Products2)
     
    And we can use this code to get the slected items in Gallery:
    Filter(Products2,IsChoosen)
    vyueyunmsft_2-1711958864269.png

     

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     
     
  • Meghna_Jain Profile Picture
    5 on at

    Hi,

     

    Thankyou for the solution. I am able to resolve the issue now.

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard