How do I set the value of a combo box to one of the choices in the Combo box ?
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.
@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.
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.
A note, you may need to unlock your field to make changes:
Try setting DefaultSelectedItems to:
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.
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.
@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,
"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.
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
Check out new user group experience and if you are a leader please create your group
Next call is happening on April 21st at 8a PST.
May the fourth be with you, join us online!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.