cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
droper
Level: Powered On

ComboBox DefaultSelectedItems

Hi All,

So I'm having an issue with ComboBox and DefaultSelectedItems not actually being stored.

Similar to this post, but I am not using datacards so the workaround doesnt assist: https://powerusers.microsoft.com/t5/General-Discussion/Powerapps-saving-combo-box-default-value-no-u...

I have a multiple selection Combobox with DefaultSelectedItems pointing to a Datatable field (which is inturn a lookup field in SP, so contains Id & Value). The idea is that the user needs to confirm a previous selection before submission, but they have the ability to modify it first if something has changed.

Now the default items set fine, it visually shows on the combobox, but if you try and actually see the data behind it, it knows there are items but the values are blank. I can even reselect an already selected item and it doubles up in the combobox, I assume because the defaultitem value isnt being stored it doesnt realise that newly selected value is already present.

To prove the point I created another DataTable which has Items=Combobox.SelectedItems so that I could see the stored contents live, and while it does return the right number of rows for the defaultselecteditems in the combobox, the values are blank. If however I select additional items in the combobox, the new values do appear, further backing up the point that the defaultselecteditems values are not actually being stored as a real selected item.

If anyone has any thoughts, it would be greatly apreciated, as this is essentially the last hurdle to having a full functioning app!

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
droper
Level: Powered On

Re: ComboBox DefaultSelectedItems

So it looks like I've found a solution for anyone else that comes across this in future.

The issue was that the combobox defaultselecteditems needs ID and DisplayField, not Id (lowercase d) and Value as returned by the multiple selection field from sharepoint.

The workaround was to correct the column names in defaultselecteditems, which then stored the actual data.

EG:  DefaultSelectedItems = RenameColumns(DataTable.Selected.Items,"Id","ID","Value","DisplayField")

View solution in original post

4 REPLIES 4
droper
Level: Powered On

Re: ComboBox DefaultSelectedItems

So it looks like I've found a solution for anyone else that comes across this in future.

The issue was that the combobox defaultselecteditems needs ID and DisplayField, not Id (lowercase d) and Value as returned by the multiple selection field from sharepoint.

The workaround was to correct the column names in defaultselecteditems, which then stored the actual data.

EG:  DefaultSelectedItems = RenameColumns(DataTable.Selected.Items,"Id","ID","Value","DisplayField")

View solution in original post

gautmish
Level: Powered On

Re: ComboBox DefaultSelectedItems

Hi @droper,

 Need urgent help on setting default selected item of a combobox .

 I am storing the combobox selected item in to a text field of sharepoint with "," separated .

 

Textvalue = "Item1,Item2,Item3"

 

So when next time user will navigate to the form , he should be able to see Item1, Item2,Item3 selected .

 

and it should not allow user to select Item1 or Item2 or Item3 again .

 

Please suggest.

 

Thanks

Gautmish

Highlighted
droper
Level: Powered On

Re: ComboBox DefaultSelectedItems

Hi,

First thing that springs to mind is that the defaultselecteditems property requires table values, not a single string of text as you have. So you would either need to wrap this in the table function or store it in a collection first with clearcollect and reference that.

 

Here is another thread to do with the basics of setting default values that might help explain it further:

https://powerusers.microsoft.com/t5/General-Discussion/How-To-set-the-selected-value-of-a-combo-box-...

 

digitaldanlim26
Level: Powered On

Re: ComboBox DefaultSelectedItems

use ForAll function in DefaultSelectedItems property

 

ForAll(tableSource,Result)

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 166 members 6,193 guests
Please welcome our newest community members: