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 / combo box collection -...
Power Apps
Answered

combo box collection - remove item

(0) ShareShare
ReportReport
Posted on by 1,257 Super User 2024 Season 1

I have the following as the on change property of a combo box

Collect(colmycollection,cb_1.Selected.Name)

I then use that collection to populate a gallery

 

however how do I remove an item from the collection if someone for example accidentally chooses an item then un chooses it.. because I only have a collect function how/where do I put the remove bit !

 

TIA

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @vffdd 

    Question...why are you using a collection??  Your combobox already is a "collection" of the data you need.

    If you interact with it, you will eliminate all the work you're creating for yourself with a collection.

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    Thanks @RandyHayes if I could do that even better but how do I populate a gallery with the selected items from a combo box had already actually tried that but maybe was just getting the syntax wrong, in fact most likely I was

     

    cb_1.Selected.Name

     

    had also tried

    cb_1.SelectedItems

     

    and multiple variations of the above !! as the items property for gallery 🙂  clearly missing something

     

    Thanks

     

     

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

    @vffdd 

    What is the Items property of your Gallery and what is the Items property of your Combobox?

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    just to add had also tried putting this as the items of the gallery  (MyVar is a variable set up to collect the datasource on startup as it's pretty static)

     

    Filter(MyVar,=cb_1.Selected.Name)

     

    No errors but blank items in gallery

     

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

    @vffdd 

    What was your working formula before? 

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    well that was using the collection

     

    Collect(colmycollection,cb_1.Selected.Name)

     

    Then I used that collection as the items property in the gallery

     

     

     

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

    @vffdd 

    Hmmm....that's not making much sense!  Your collection would have only had one value in it (specifically, one record with a Value column that contained the value of the Selected Name from the combobox)

     

    So how did that correlate to your datasource??  Or doesn't it?

     

    Not really sure of the purpose of having a gallery to just show one record from a combobox!?

     

    Can you expand on that some?

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    No my collection had  multiple items in it because it was on the on change property of the combo box so it added a name everytime I selected on...however my issue is that if I de-selected one it didn't remove it !

     

    I'm wondering if I could use the removeif function also on the on change.. some how?

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

    @vffdd 

    Can you not just have the multiple-selections option on your combobox??

    Then your SelectedItems of the combobox contains everything that you need.

     

    Or are you trying to "simulate" that with a collection so how?

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    sorry maybe we getting confused here 🙂

     

    Yes I do have the multi-select option turned on.  I want to take all those selected items and populate a gallery with them because I need to do other things in the gallery !

     

    The only way I could find to do it was create a collection of all of the item selected as per my code above and use that as the items property for the gallery.  All works well.

     

    If I could use the combobox selected items as the items property for the gallery yes that would definitely work and cut out the need for the collection cos it's not used anywhere else.  and it would solve the remove issue.    However as I mentioned above I've tried various combinations but can't get that to work !  So I'm probably just getting the syntax wrong..

     

    thanks for your patience ! 🙂

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard