cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Display collection values in dropdown?

Hello, 

 

I'd like to display the values of a Collection, inside Dropdowns rather than Text Boxes. This is so a User can edit a record in the Collection and only choose from specific values when editing. 

 

Heres the collection: 

dropdownCollection2.png

When I set the Dropdown value to ThisItem.value (just like a Text box), the Dropdowns remain blank. 

dropdownCollection.png

 

Is it possible in PowerApps to show the value of a Collection in a Dropdown? 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Display collection values in dropdown?

Hi @ericonline,

 

Could you please share a bit more about your app's configuration?

Is the Edit form connected to the Collection (colWorkSummary)? 

Further, do you want to display event_type value of the Collection within the Select Type Drop down control and display event_detail value of the Collection within the Select Detail Drop down control?

 

I have made a test on my side, please take a try with the following workaround:5.JPG

 

6.JPG

 

 

Set the OnVisible property of the Screen to following formula:

ClearCollect(
colWorkSummary,
{
comments:"No comments",
event_detail:"Ditching",
event_type:"Production",
hours2:"08",
id:1,
minutes:"00"
},
{
comments:"No comments",
event_detail:"Ditching1",
event_type:"Development",
hours2:"12",
id:1,
minutes:"30"
}
)

Set the Items property of the SelectType Drop down control to following formula:

Distinct(colWorkSummary,event_type)

Set the Items property of the SlectDetail Drop down control to following formula:

Distinct(colWorkSummary,event_detail)

 

On your side, please take a try to set the Default property of the Select Type Drop down control to following formula:

ThisItem.event_type

Set the Default property of the Select Detail Drop down control to following formula:

ThisItem.event_detail

Or

 

Set the Items property of the Select Type Drop down control to following formula:

Distinct(colWorkSummary,event_type)

Set the Items property of the Select Detail Drop down control to following formula:

Distinct(colWorkSummary,event_detail)

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Display collection values in dropdown?

Hi ericonline,


I often use dropdowns to control input into plain text columns - makes the data source so much flatter and easier to manage.

The dropdown control accepts arrays as hardcoded options for the dropdown, so

 

Items property on dropdown:

["option 1", "option 2", "option 3"]

The default value of the dropdown can then be what the current recorded value of the field is, as long as it's part of that array it will display - assuming you're only using this control to capture data, this should always be the case.

 

Default property on dropdown:

ThisItem.ColumnName

 

If you want the options to be more dynamic (as in, coming from the column itself, or another data source) this is also easy enough.  Let me know if this helps, otherwise we can explore a bit more 🙂

 

[edit]

Reading your question, it might be worth adding this piece;

 

If you want the values to come from the existing collection itself, change the Items property function as follows;

Distinct('Source', ColumnName)

and set the Value sub-field to Result if it doesn't do it automatically.  The default value can stay as mentioned above. 

This will create a dropdown of existing values - just bear in mind you may encounter delegation issues (and take a performance hit) if the query has to return a full 500 rows before determining the Distinct values of those 500 rows. 

If you know what your values need to be, better to hard code them, or fetch them from a lookup list/column somewhere that is unlikely to change.

 

Kind regards,

 

RT

Highlighted
Community Support
Community Support

Re: Display collection values in dropdown?

Hi @ericonline,

 

Could you please share a bit more about your app's configuration?

Is the Edit form connected to the Collection (colWorkSummary)? 

Further, do you want to display event_type value of the Collection within the Select Type Drop down control and display event_detail value of the Collection within the Select Detail Drop down control?

 

I have made a test on my side, please take a try with the following workaround:5.JPG

 

6.JPG

 

 

Set the OnVisible property of the Screen to following formula:

ClearCollect(
colWorkSummary,
{
comments:"No comments",
event_detail:"Ditching",
event_type:"Production",
hours2:"08",
id:1,
minutes:"00"
},
{
comments:"No comments",
event_detail:"Ditching1",
event_type:"Development",
hours2:"12",
id:1,
minutes:"30"
}
)

Set the Items property of the SelectType Drop down control to following formula:

Distinct(colWorkSummary,event_type)

Set the Items property of the SlectDetail Drop down control to following formula:

Distinct(colWorkSummary,event_detail)

 

On your side, please take a try to set the Default property of the Select Type Drop down control to following formula:

ThisItem.event_type

Set the Default property of the Select Detail Drop down control to following formula:

ThisItem.event_detail

Or

 

Set the Items property of the Select Type Drop down control to following formula:

Distinct(colWorkSummary,event_type)

Set the Items property of the Select Detail Drop down control to following formula:

Distinct(colWorkSummary,event_detail)

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,373)