cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ShaneITAutomate
Helper V
Helper V

defaultselecteditems doesnt save if the user doesnt select the defaulted item

Hi i have a canvas app that a user saves items to a collection to be shown in a gallery and then i patch it to sharepoint,

 

I have several combo boxes with defaultselecteditems with a default most commonly selected item, however unless the user selects the default item it does not save. any work arounds for this bug?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@ShaneITAutomate 

So the thing about Comboboxes is that your DefaultSelectedItems needs to match the schema of the Items property.  If you are using ["test1"] in your DefaultSelectedItems, then this is a Table with a single column called Value that has a record with a test1 in the Value column...this will not match what you have in the Items.

 

If you set your DefaultSelectedItems property to:

   {id:1, testname:"test1", testcode:T1}

then it would match.

You could also potentially get away with:  

   RenameColumns(["test1"], "Value", "testname")

 

When you set it as you have, you will see what appears to be a selection in the combobox and, this is why I asked about the actual values in the dropdown being selected, they will actually not match the records you want and thus will be what I call "ghosted".  If there is not a selection shown in the Dropdown portion of the Combobox, then there is no selection, regardless of what the input box of the combobox shows.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@ShaneITAutomate 

It is no bug, this is a flaw in what you have in your formulas.

What are:

1) the Items property for the ComboBox

2) the DefaultSelectedItems property of the combobox

3) the formula you are using to put the items in the Collection

4) the formula you are using to put the collection to the datasource.

 

One of the first things to check...you say you are setting the DefaultSelectedItems - are they really selected?  you can tell this by looking at the actual list of values in your combobox.  If you drop down the list, are the records you expect to be selected actually showing as being selected?  If not, then they are ghosted values that are not really selected and will not end up in your results.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

the items are the name from a collection that i create onstart.

 

i.e. combobox1.items:colTEST

 

Clearcollect(colTEST, {id:1,testname"test1,testcode:T1},{id:2,testname"test2,testcode:T2}) etc

 

the defaultselecteditems are ["test1"] (if the testname is the selected etc)

RandyHayes
Super User
Super User

@ShaneITAutomate 

So the thing about Comboboxes is that your DefaultSelectedItems needs to match the schema of the Items property.  If you are using ["test1"] in your DefaultSelectedItems, then this is a Table with a single column called Value that has a record with a test1 in the Value column...this will not match what you have in the Items.

 

If you set your DefaultSelectedItems property to:

   {id:1, testname:"test1", testcode:T1}

then it would match.

You could also potentially get away with:  

   RenameColumns(["test1"], "Value", "testname")

 

When you set it as you have, you will see what appears to be a selection in the combobox and, this is why I asked about the actual values in the dropdown being selected, they will actually not match the records you want and thus will be what I call "ghosted".  If there is not a selection shown in the Dropdown portion of the Combobox, then there is no selection, regardless of what the input box of the combobox shows.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Thankyou for answering and breaking it down for me, that makes alot of sense.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (967)