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 / Updating a collection ...
Power Apps
Unanswered

Updating a collection from user input entered into a combo box

(0) ShareShare
ReportReport
Posted on by 446

Temporary Collection.gif

 

As you can see in the above GIF, I'd like to add new values to a temporary collection (located on the far right). It works the first time around but if you attempt to add another custom value it blanks out all the previous values and adds the newest one.

 

This is basically a workaround to allow custom user input which will automatically select the custom value as well everything else that was selected too, while also clearing the search text. From what I've read in multiple places on this forum and online, there is no easy or built-in way of doing this. Otherwise the user would enter the value, select the Yes button, which adds it to the permanent collection (located left of the temporary one). Then the user would have to select the combo box, select the value they just added, and clear out the search text. This is very clunky and not something I want.

 

How do I get the temporary collection to keep the previous entries and simply add the new one? I've tried ClearCollect assuming it would basically just be constantly "refreshing" itself, but that doesn't seem to be the case. I've also tried to just place a Clear(TempServersCollection) before a regular Collect thinking it would empty the collection and grab everything again, but it doesn't. Here is my code:

 

ComboBox2

 

Items = Servers
DefaultedSelectedItems = TempServersCollection

 

 

'Yes Button' - OnSelect

 

Collect(
 Servers,
 {'Server Name': ComboBox2.SearchText}
);
Clear(TempServersCollection);
Collect(
 TempServersCollection,
 ForAll(
 ComboBox2.SelectedItems,
 {Value: Text('Server Name')}
 ),
 {Value: ComboBox2.SearchText}
);
Reset(ComboBox2);

 

 

Gallery1

 

Items = Servers

 

 

Gallery2

 

Items = TempServersCollection

 

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

    @Ryan_B 

    If you want I can address this here or in the other thread where you have this question that we were working on.

    Sorry I've not responded on that one yet today, but it is in my rotation still.

     

  • Ryan_B Profile Picture
    446 on at

    @RandyHayes 

    Either or! I opened this one since it was technically a different topic with not as expansive of a solution. I've been exploring alternative options to my original post and came pretty close to finding out a possible solution with this one.

     

    I think if I can get this to work this could be the solution I use unless you have a better alternative, as I don't think you aren't fond of using collections. 😋 

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

    @Ryan_B 

    Collections have their place.  I just see them way overused and try to not provide solutions that don't need them.

     

    I have a complex response rotation for forum posts where I answer today's responses first and then work on the backlog from prior days.  So, I still have your other post on my screen to respond to and will do so.  Sorry on the delay.

     

    I will need to review over the other post and get back with you today on it all.

  • Ryan_B Profile Picture
    446 on at

    @RandyHayes 

    No worries! In that case you can go ahead and continue with the other topic then. Someone else might have an idea on how to resolve the problem I've posted here.

     

    Thanks!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 545 Most Valuable Professional

#2
Haque Profile Picture

Haque 314

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard