cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

ComboBox default selected items from a collection doesn't work

Hello everyone.

I'm having troubles loading defaults into a combobox, from a collection.

I have a ComboBox that's defined like this:

The SelectedItems is a collection that's collected by calling

 

ClearCollect(SelectedItems,ComboBox1.SelectedItems);SaveData(SelectedItems, "SavedSelectedItems");

So it's expected that when the SelectedItems collection isn't empty, it will have those entries selected as default.

 

However, this is only partly working.

 

The preview of the ComboBox looks fine, like this:

However, when you press it, the items aren't actually selected.

What am I doing wrong?
I uploaded a simple reproduction project and attached to this topic, if you want to try it out and see what I mean.

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Could you please share a bit more about your SelectedItems collection?

 

I have made a test on my side, and found that there is something issue with the value you typed within the DefaultSelectedItems property of the ComboBox.

Please take a try with the following workaround for more details:4.JPG

 

5.JPG

Set the DefaultSelectedItems property of the ComboBox to following:

ForAll(
       SelectedItems,
       {
           Value: Value
       }
)

On your side, please consider take a try to set the DefaultSelectedItems property of your ComboBox to following:

ForAll(
       SelectedItems,
       {
           Value: Value
       }
)

then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Based on the issue that you mentioned, I think you have some misunderstanding with the DefaultSelectedItems property of the ComboBox control.

 

The DefaultSelectedItems property of the ComboBox control is used to set a Default value within the ComboBox control. But the Default value just be displayed within the ComBoBox, rather than select corresponding values from the ComboBox available options and display it.

 

In other words, the Default value just be used as a Display value within the ComboBox, which would not be recognized that you selected corresponding values from the ComboBox available options.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you.

So just to clarify is it not possible having a ComboBox that has some items selected by default?

 

 

 

Hi @Anonymous ,

Could you please share a bit more about your SelectedItems collection?

 

I have made a test on my side, and found that there is something issue with the value you typed within the DefaultSelectedItems property of the ComboBox.

Please take a try with the following workaround for more details:4.JPG

 

5.JPG

Set the DefaultSelectedItems property of the ComboBox to following:

ForAll(
       SelectedItems,
       {
           Value: Value
       }
)

On your side, please consider take a try to set the DefaultSelectedItems property of your ComboBox to following:

ForAll(
       SelectedItems,
       {
           Value: Value
       }
)

then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

In your DefaultSelectedItems field place an array value. i.e. Use brackets notation [fieldname]

e.g. For a collection field called 'amount' just put [amount] in the default selected field.

@infoman Hi,

 

Can you elaborate please? I've a collection which is storing the selected items from a combobox control. That is fine. However, when i'm trying to default the selected items, it's throwing an error. I tried wrapping the column name from the collection in square brackets. But it didn't work.

 

Much appreciated if you can share more details.

 

Thanks,

Sasi.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (32,516)