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 / Gallery with checkboxe...
Power Apps
Unanswered

Gallery with checkboxes - Uncheck property error.

(0) ShareShare
ReportReport
Posted on by 20

Hello, 

 

I'm having an issue with checkboxes in a gallery. On one screen, I have a gallery with people and checkboxes. I want the user to be able to select certain people and on a separate screen, compose an email to them. 

 

I have the OnCheck property of the checkbox set to add the person to a collection. The UncCheck property is set to remove them from the collection. This was working fine at first. 

 

Then I added a checkbox a the top to "Select All". To do this, I just set the default of the checkbox to "SelectAll_checkbox.Value".  This works as expected, but now the UnCheck property of the individual box gives me an "incompatible type" error. 

 

Worst case scenario, I can always remove the "Select All" box, but I would prefer them to be able to select all and unselect some. Has anyone been able to accomplish something like this or know a way around it?

 

Thanks, 

 

Jen

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at
    Please what is the formula for the OnUncheck.
    If it a number field you can wrap it with
    Value(ColumnName)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @jfloresuh 

    You might want to consider a more simplistic approach to this.  From your description, there is no need for the check and uncheck actions or anything else complex.

    Simply have your list generate from the values of your Gallery - Concat(Filter(Gallery, Checkbox.Value), email & ";")

    Then for the "Select all" just add a checkbox for that and set the default property of the checkbox in your Gallery to that checkbox value:  CheckboxInGallery.Default - chkSelectAll.Value

     

    I've attached a sample app that demonstrates this pretty easily.  Download the app, go into PowerApps and open a app or create a new one.  Then once in the designer, File->Open-Browse and then browse to the downloaded file.

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    on at

    Hi @jfloresuh ,

     

    I've replicated what you've done and I'm getting the same error. I've managed to work around it by storing the data in a collection first in the screen's OnVisible property with Collect(MyOriginalList,'Test List') and setting the Items property of the gallery to the new collection MyOriginalList (table data type).

     

    Seems to work with the following values after that:

     

    SelectAll_checkbox:
    
    
    
    OnCheck: ClearCollect(MyNewList,Gallery1.AllItems)
    
    OnUncheck: Clear(MyNewList);
    
    
    
    GalleryCheckbox: 
    
    Default: SelectAll_checkbox.Value
    
    OnCheck: Collect(MyNewList,ThisItem)
    
    OnUncheck: Remove(MyNewList,ThisItem)
    

     

    This should then add and remove the data from MyNewList collection as intended.

  • v-bofeng-msft Profile Picture
    on at

    Hi @jfloresuh :

    Do you want to implement the following functions

    1\Check box in Gallery:

    • OnCheck: add the item to a collection
    • OnUncheck:remove the item from the collection

    2\The SelectAll_checkbox:

    • OnCheck: add all of the items to a collection and change the default property of all checkboxes to "true".
    • OnUncheck:clear the collection and change the default property of all checkboxes to "false".

    Thanks for @Anonymous ‘s solution.

    I made a similar test but didn’t encounter the "incompatible type" error.

    Let me show you the solution:

    Test1 is my date source

    mycollection is a custom collection

    Step1:Gallery:

    • Items: Filter(Test1,Name<>"A")                      /*you can use your rules here*/

    Step2:Check box in Gallery:

    • OnCheck: Collect(mycollection,ThisItem)        
    • OnUncheck: Remove(mycollection,ThisItem)
    • Default:SelectAll_checkbox.Value

    Step3:The SelectAll_checkbox:

    • OnCheck: ClearCollect(mycollection, Filter(Test1,Name<>"A"))   
    • OnUncheck: Clear(mycollection)

    The point is , using the items property of the gallery instead of Gallery1.AllItems to fill the custom collection.

     
     

    If you still have problems, could you  show more detail about your Check boxes?

    If you still have any question, dont hesitate to let us know.

     

    Beat Regards,

    Bof

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @jfloresuh 

    Are you still encountering your issue?

    There have been a variety of posts here to explore.  Please let us know if there are questions or if your solution has been achieved.

  • jfloresuh Profile Picture
    20 on at

    @RandyHayes Thank you, I am trying to see if I can get this to work. How do I download your app? I don't see an attachment.

  • jfloresuh Profile Picture
    20 on at

    @Anonymous I thought this was going to work because I stopped getting the error, but it is still not removing the item from the collection when unchecking the box. If I use the individual check boxes to add the item, and then uncheck it, it adds and then removes them from the collection. But if I use the select all checkbox to add them all and uncheck some of them, the uncheck does not remove them. 

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @jfloresuh 

    Hmmm, not sure why the app was no longer attached to the post.

     

    Well, I've attached it again.  Let's see if it's there and go ahead and take a look at it.  I believe it will answer your questions.

  • jfloresuh Profile Picture
    20 on at

    @RandyHayes This worked and it is so much simpler! Thank you!!

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @jfloresuh 

    Yes, I thought the solution was quiet simple.  I'm sorry I didn't notice that the App was not attached to the post...that would have helped you out sooner.

    Happy PowerApp'ing

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard