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 / Control checkbox true/...
Power Apps
Answered

Control checkbox true/false value based on collectoin

(0) ShareShare
ReportReport
Posted on by 363

I have a gallery with a checkbox. The gallery receives the number of checkboxes based on the number of choices from a SP list as well as those names from the choices in the SP list. I have it setup when a checkbox is selected it adds to a collection and when unchecked it removes it from the collection. I want the checkboxes to all be checked and have populated the collection at app start up. I tried setting the default value to true which makes all the checkboxes checked. Then for the collection to be prepopulated I typed ClearCollect(colChkRef,["Section Corners", "Lot/Block Corners", "Additional Information"]); in the Apps Onstart. however when I uncheck the box it does not remove the value from the collection. It only adds a new one and then removes that new one.

colbyturybury_0-1627929706733.png

 

Categories:
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @colbyturybury ,

    Would please the onCheck and onUncheck property of checkbox ? It seems when you are collection the values on start it is getting collected to a different column.  

  • colbyturybury Profile Picture
    363 on at

    The onCheck says: Collect(colChkRef, ThisItem)

    The OnUncheck says: Remove(colChkRef, ThisItem)

     

    When starting the app the collections looks like this.

    colbyturybury_1-1627939676946.png

     

    When unchecking then rechecking it looks like this.

    colbyturybury_2-1627939688778.png

    It never removes what was placed in the collection from the App Start. 

  • Verified answer
    v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @colbyturybury ,

    Use this formula for OnUncheck property of your checkbox:

    RemoveIf(colChkRef, Value=ThisItem.Value)

    Best regards,

    Allen

  • colbyturybury Profile Picture
    363 on at

    Perfect! Thank you. Simple copy and paste. Would you mind explaining it to me? 

  • v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @colbyturybury ,

    This is because RemoveIf function will find then remove all the matched records(records with same value), however Remove(colChkRef, ThisItem) will only remove this single record.

    valbaimsft_0-1628040118514.png

    Remove and RemoveIf functions in Power Apps - Power Apps | Microsoft Docs

    Best regards,

    Allen

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard