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 / DefaultSelectedItems r...
Power Apps
Answered

DefaultSelectedItems removes string with items from collection

(0) ShareShare
ReportReport
Posted on by 190

Hi,

 

I have a list of items stored in a text-field ("Items") in a collection ("MyCollection"): "Item1, Item2, Item 3"

 

In order to show these items in a combobox I first split the text and store the items in a collection:

 

ClearCollect(
 colItems;
 ForAll(
 Split(
 LookUp(
 MyCollection;
 Serialnumber="12345"
 ).Items;
 ","
 );
 {Value: Result}
 )
);;

 

 

In the DefaultSelectedItems-property of my combobox I have:

 

colItems.Value

 

 

When the screen on which the combobox is located is shown, the text-field Items is being emptied. When I remove the code in the DefaultSelectedItems-property, the string in Items remains as intended.

 

Why is the DefaultSelectedItems-property removing content from the collection?

 

Regards

Lukas

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

    @Lukas1 

    Your DefaultSelectedItems property (DSI) needs to be a record (or a table of records if multi-select) that matches the record schema of the Items property.

     

    I am not sure if your intention is to select all of the items in your combobox, or if you even have multi-select on.  

     

    Please consider changing your Items property Formula to the following:

    RenameColumns(
     Split(LookUp(MyCollection; Serialnumber="12345").Items; ",");
     "Result"; "Value"
    )

     

    You now need to supply a Record to the DSI that is based on this table (a single "Value" column table).

     

    So, {Value: "Item1"} for example, in the DSI would select Item1 in the combobox.

     

    Since I am not sure what your goal is with the selections, I will leave it with that in hope that it provides the information you need.  If not, then please elaborate on what you are trying to select in the control.

     

    I hope this is helpful for you.

  • Lukas1 Profile Picture
    190 on at

    @RandyHayes, thanks!

     

    The combobox (multiselect) gets its items from another collection. The user can now select one or more items and these selected items are stored in MyCollection (as a comma separated string as decribed above plus a unique identifier, in this case Serialnumber).

     

    The user should be able to access the data that was previously stored in MyCollection by selecting a Serialnumber. That's why I would like to use the comma separaetd items in the DSI of the combobox.

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

    @Lukas1 

    Just to double check...you marked my last post as a solution, but I am not sure if you have the solution you need now with your last post.

    Are you good now or still having an issue?

  • Lukas1 Profile Picture
    190 on at

    @RandyHayes I struggled first but then I realised that all I have to do is to use the term {Value: "Item1"} (as mentioned in your first reply) in a ForAll loop. So yes, I'm good, thanks a lot for your help 🙂

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

#2
Haque Profile Picture

Haque 273

#3
Kalathiya Profile Picture

Kalathiya 232 Super User 2026 Season 1

Last 30 days Overall leaderboard