cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Dynamic table / gallry rows based on Dropdown selections

I am using the dropdown control for multiple select. I would like that every item selected in the dropdown be reflected in a table below the selection. Is this possible? 

 

Example: 

 

Control has 3 selections: Mike | Janice | Steve (this are names coming from a secondary list)

 

Table / Gallery: 

Name | Title | Age | Gender

------------------------------

Mike | CEO | 45| M

Janice | CEO | 49| F

Steve | COO 34| M

 

Then if I select another name in my dropdown or add more, the table should update to reflect the change. 

 

Is this possible in PowerApps?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User
Super User

Hi @simkessy, instead of a dropdown, could I suggest using a combo box? They have a multiselect option built in and to accomplish what you are wanting is a pretty simple chunk of code in your data table/gallery:

 

// In the Items property of your data table/gallery
ComboBox1.SelectedItems

If you use a data table, be sure to select the fields you want to show. They should appear and disappear as selected. 

 

If you really want to use a dropdown, this could be accomplished by putting some code in the OnChange property of your dropdown to add or remove each selected item from a collection, which would be tied to your data table/gallery. Something like:

// In the OnChange property of the dropdown titled Dropdown1
UpdateContext({Dropdown1Reset: false}); If( IsBlank( LookUp( colDropDownItems, Value = Dropdown1.Selected.Value ) ), Collect( colDropDownItems, Dropdown1.Selected ), Remove( colDropDownItems, Dropdown1.Selected ) ); UpdateContext({Dropdown1Reset: true})

Allow me to explain. Essentially this either adds or removes a selected item from a dropdown based on it's exisitance in a collection. There is a local boolean variable, Dropdown1Reset, that is toggled to reset the dropdown so you will need to put the following in the Reset property:

// In the Reset property of Dropdown1
Dropdown1Reset

You would also need to make sure that the AllowUnsetValue property of the dropdown is set to true and the Default property is set to "". This, coupled with the Reset variable will set the dropdown back to a blank value after a selection is made. Otherwise, you will need to select another value to reset a previously selected one.

 

I made a quick demo app to work out the dropdown code and put a combo box demo in there as well. It is attached below. Let me know if I can help out more with this or if I need to explain anything better.

 

View solution in original post

Highlighted
Community Support
Community Support

Hi @simkessy 

 

You can reference @wyotim 's suggestion and the comboBox will be convenient for you to achieve this.

ComboBox1.PNG

You can test with his workaround,it describes clearly.

If you have solved your issue ,please accept his workaround as solution.

 

More information:

control-combo-box

control-drop-down

 

Best Regards.

Yumia

View solution in original post

7 REPLIES 7
Highlighted
Super User
Super User

Hi @simkessy, instead of a dropdown, could I suggest using a combo box? They have a multiselect option built in and to accomplish what you are wanting is a pretty simple chunk of code in your data table/gallery:

 

// In the Items property of your data table/gallery
ComboBox1.SelectedItems

If you use a data table, be sure to select the fields you want to show. They should appear and disappear as selected. 

 

If you really want to use a dropdown, this could be accomplished by putting some code in the OnChange property of your dropdown to add or remove each selected item from a collection, which would be tied to your data table/gallery. Something like:

// In the OnChange property of the dropdown titled Dropdown1
UpdateContext({Dropdown1Reset: false}); If( IsBlank( LookUp( colDropDownItems, Value = Dropdown1.Selected.Value ) ), Collect( colDropDownItems, Dropdown1.Selected ), Remove( colDropDownItems, Dropdown1.Selected ) ); UpdateContext({Dropdown1Reset: true})

Allow me to explain. Essentially this either adds or removes a selected item from a dropdown based on it's exisitance in a collection. There is a local boolean variable, Dropdown1Reset, that is toggled to reset the dropdown so you will need to put the following in the Reset property:

// In the Reset property of Dropdown1
Dropdown1Reset

You would also need to make sure that the AllowUnsetValue property of the dropdown is set to true and the Default property is set to "". This, coupled with the Reset variable will set the dropdown back to a blank value after a selection is made. Otherwise, you will need to select another value to reset a previously selected one.

 

I made a quick demo app to work out the dropdown code and put a combo box demo in there as well. It is attached below. Let me know if I can help out more with this or if I need to explain anything better.

 

View solution in original post

Highlighted
Community Support
Community Support

Hi @simkessy 

 

You can reference @wyotim 's suggestion and the comboBox will be convenient for you to achieve this.

ComboBox1.PNG

You can test with his workaround,it describes clearly.

If you have solved your issue ,please accept his workaround as solution.

 

More information:

control-combo-box

control-drop-down

 

Best Regards.

Yumia

View solution in original post

Highlighted

Thank you, this was very helpful. I was able to get what I was triyng to do accomplished

 

Highlighted

@wyotim 

Hi

 

You wrote

// In the Reset property of Dropdown1
Dropdown1Reset

Is this a typo? i can't seem to figure out what you actualy mean.    Dropdown1 is the name of the dropdown, and Reset is the command i assume. but there is no  .Reset on a dropdown menu.

Highlighted

To future readers: Wyotim explained it more clearly in a newer comment.

 

@wyotim 

also you say on a combobox :

 

 

// In the Items property of your data table/gallery
ComboBox1.SelectedItems

 

 

which won't work, it won't give an error but it will also not work.

dontwork.png

 

Highlighted

Hi @gjeh! To answer your first question, that isn't a typo. Dropdown1Reset is a variable name, not a reference or function. To be fair, I should have named it something like varDropdown1Reset to make it more clear. Here is the relevant text from my solution; maybe it will help explain:

Allow me to explain. Essentially this either adds or removes a selected item from a dropdown based on it's exisitance in a collection. There is a local boolean variable, Dropdown1Reset, that is toggled to reset the dropdown so you will need to put the following in the Reset property:

// In the Reset property of Dropdown1
Dropdown1Reset

You would also need to make sure that the AllowUnsetValue property of the dropdown is set to true and the Default property is set to "". This, coupled with the Reset variable will set the dropdown back to a blank value after a selection is made. Otherwise, you will need to select another value to reset a previously selected one.


That variable is to reset the dropdown as it is being used in an uncommon way in that case. Rather than being a single selection control, it is being hacked to function like a multi-select enabled combo box. That solution is a bit of a one-off case and a combo box would be the better control to use for most people.

On your second issue, I would be happy to help you troubleshoot the problem you are running into if you would like. You could also download the sample app I provided in the solution if that would help. I did so to test if anything had changed and it still worked as designed.

To be clear, there are two methods in play: the combo box method and the dropdown method. It looks like you are using both at once, so one of them wouldn't work based on the solution I provided. Again, I would be happy to help you troubleshoot your situation if you would like! Just let me know!

Highlighted

@wyotimthanks for the clarifying reply, Yes i am currently trying both but I was trying the dropdown menu first, then i read your post and started to try the combobox.  (i left the dropdown menu because there was no need of deleting it just yet).

 

I'll try to work out what you explained, thanks!

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 (7,182)