cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
NigelP
Level 8

How To set the selected value of a combo box to one of the choices using PowerApps

Hi

How do I set the value of a combo box to one of the choices in the Combo box ?

 

Thanks

 

Nigel

11 REPLIES 11
keathley
Level: Powered On

Re: How To set the selected value of a combo box to one of the choices using PowerApps

You can do this by setting the "DefaultSelectedItems" property of the ComboBox.  For my example I created a new app and added a ComboBox to the app.  The ComboBox's Items property is set to "ComboBoxSample"

 

I then set the DefaultSelectedItems property to:

 

Filter(ComboBoxSample, Value1="Item 2")

Where I filtered the ComboBox's data source down to the item I wanted to set it to.  Note that you could filter by any propery on the objects on the combo box. 

 

Alternatively if you want to do it from another control (such as a button), you would need to set the ComboBox's DefaultSelectedItems property to a variable (such as "ComboBox1Item"), and set the OnSelect of your control (or button) to something like:

 

Set(ComboBox1Item,Filter(ComboBoxSample, Value1="Item 3"))

Where you are changing the variable to be the item you want selected.

 

More help on Filter can be found here.

 

Good luck,

Joey

NigelP
Level 8

Re: How To set the selected value of a combo box to one of the choices using PowerApps

Hi

 

Apologies if this is a daft question, but I dont have a Value1 on the list of properties for my combo box.

 

Regards

 

Nigel

keathley
Level: Powered On

Re: How To set the selected value of a combo box to one of the choices using PowerApps

@NigelP No worries, that's because I used the SampleDataSource whereas you would be using a real on.  You will have properties (in place of Value1) from your data source.  So if your dropdown has people, you may have Given Name and Surname properties.  Then you would simply filter by and search by a property that you have (and want to use to identify the item to set it to).

 

If you can supply a screen shots it will be helpful in formulating the correct function.

 

Cheers,

Joey

NigelP
Level 8

Re: How To set the selected value of a combo box to one of the choices using PowerApps

Hi

 

The combo box in question i called submission status and has a number of statii :- Draft, awaiting qa, on agenda and completed.  These are menu items in a SharePoint choice field.

 

The combo box items on the screen are set up as Choices(Submissions.Assurance_status)  the choices being the ones above.

 

All I want to be able to do is set the Assurance_Status field using PowerApps.

 

DefaultSelectedItems property of the drop down is blank, DisplayFields property is set to ["Value"], Items is as above.(Choices(Submissions.Assurance_Status), Search Field is set to ["Value"]

 

Thanks in advance for your help.

 

REgards

 

Nigel

keathley
Level: Powered On

Re: How To set the selected value of a combo box to one of the choices using PowerApps

@NigelP 

 

A note, you may need to unlock your field to make changes:

6.PNG

 

Try setting DefaultSelectedItems to:

 

Filter(Choices(Submissions.Assurance_Status),Value="Awaiting QA")

If your form is in "New" mode, it will default to the "Awaiting QA" value.  If in "Edit" it should be set to the existing / saved value.

 

Cheers,

Joey

NigelP
Level 8

Re: How To set the selected value of a combo box to one of the choices using PowerApps

Hi keathly

 

Thats great ! 

 

Thank you very much

 

Nigel

MK1
Level: Powered On

Re: How To set the selected value of a combo box to one of the choices using PowerApps

@keathley,

 

Hi,

I'm also having same kind of issue.

In my scenario, 

I have a combo box which will be filtered based on values we choose from a Dropdown

DropDown= A, B,C

when a user selects A,C then there will be only 1 value in the combo box,

But when they choose B there will be multiple options on Combobox they need to select.

What my issue is: When a user selects A,C from dropdown a textbox should be populated with Combobox value automatically, but when user selects B they should be able to select options from combobox values.

How can i set the properties.

 

keathley
Level: Powered On

Re: How To set the selected value of a combo box to one of the choices using PowerApps

@MK1 I would recommend that you create a separate thread and reference back to this one.  The OP never closed this one, and could at any moment (cutting you off).  It is best to work from your own thead.

 

That said, I am not sure I followed the relationship between your DropDown, ComboBox and Textboxes.  It may help to have a sceen show with the various fields and values.

 

It sounded like you want the textbox populated (conditionally) from the DropDown.  For that you can put an IF function on the DefaultValue of the textbox that references the selected value on the DropDown as part of it's logical expression.

 

Hope that helps some,

Joey

MK1
Level: Powered On

Re: How To set the selected value of a combo box to one of the choices using PowerApps

@keathley

"It sounded like you want the textbox populated (conditionally) from the DropDown.  For that you can put an IF function on the DefaultValue of the textbox that references the selected value on the DropDown as part of it's logical expression."

 

yes, texbox needs to be populated conditionally. like when they select A,C from dropdown then the textbox value should be the only value from combobox.

When they select B from the dropdown, they should be able to select 3 values from combobox and populate into the textbox.

textBox= Concat(combobox.SelectedItems,Result&",")

This is the formual i used on textbox.So what ever user selects on combobox will bepopulated into textbox

But textbox should be set to default combobox option when they select A,C from dropdown

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 44 members 4,678 guests
Please welcome our newest community members: