cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Populating previously selected options in a combo box

Hello

 

We're storing selected options from the combo box into a SharePoint list. When the user goes back in to their form we need those options to show within the combo box. Is that possible yet?

4 REPLIES 4
Super User III
Super User III

@StuPower 

Yes, this is all possible with the DefaultSelectedItems property of the ComboBox.  

However, if you are using this in an EditForm, then the datacard will provide this functionality for you without having to change anything.

If you are using the ComboBox outside of an edit form, then you will need to supply the logic to the DefaultSelectedItems property of the control.

 

If you still have questions, please provide some more specific examples, screenshots or formulas that might be helpful in deducing your problem.

 

I hope this is helpful for you.

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

@RandyHayes 

 

Thanks

 

So ive had a play and i can see ComboBoxes arent as easy as normal field with regards to patching

 

i.e this won't work -

Patch('Objective Setting_1',Defaults('Objective Setting_1'),{Links to strategy:ComboBox.SelectedItems}

Ive found posts which use something like this

{'Links to strategy':ForAll(ComboBox.SelectedItems,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:Value})}

But this code dosen't work either.

 

So to over come this ive used concat and placed the values into a label and then patched the labels value into SharePoint. This part is fine for what i need.

 

But i now can't prepopulate those values back into the combobox using "defaultselecteditems" when i select my record from a gallery as from my understanding its needs a Value and a ID?

DefaultSelectedItems: ObjectiveRecord.'Links to strategy'

 

Any help is greatly appreciated as documentation on this field seems very scarce

 

@StuPower 

Actually, you might be overcomplicating things for yourself a bit.  

The first formula actually does work and works fine.

Patch('Objective Setting_1',Defaults('Objective Setting_1'),{Links to strategy:ComboBox.SelectedItems}

So, if that is not working for you, then I'd suggest getting to the root cause of that problem rather than create another method to work around it.  That will just bring you more grief. 

 

If the above is not working, then there are at least two things to look at first:

1) The definition of your column.  This is most important.  Are we looking at a Choice column (I assume) and what kind of parameters are set for it?  Does it allow multi-select?  Does it allow add-in choices?  (Are you trying to add in choices? ) Does it have any other conditions to it?

2) The Items of your ComboBox - they should be a table of Value records...that is all you need for the above to work. Best choice is the Choices function as it was designed to give you the viable choices for a column  If you are doing anything different (such as Distinct or filter or other) you will need to pre-shape the items data into a table of Value records.

 

Based on those two observations, you should be able to get to the root cause of why your patch statement doesn't work.

BUT...the point being - that patch statement should work fine if the proper conditions are set up for it.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Anonymous
Not applicable

Hi @StuPower can you review the above reply and update the thread if it was helpful? 

 

Thank you,

 

@Anonymous 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (2,315)