Michael Smith
Michael Smith

Reputation: 21

Power apps drop down

In power apps I have created a drop down list called series and another called models. How do I get the drop down in Models to reference an item in the Series drop down? For example, If the series has car, truck, van how to i get the models list to auto populate when car is chosen.

Upvotes: 2

Views: 6711

Answers (4)

Sherwin Waje
Sherwin Waje

Reputation: 1

add code on the Model dropdown > Items Properties Filter(SeriesModelTable,SeriesColumn=DropdownSeries.Selected.SeriesColumn)

Upvotes: 0

SeaDude
SeaDude

Reputation: 4365

There are many ways to do this. You need to define your data a bit more in the OP.

Yet another option is:

  1. OnVisible of the screen
    Concurrent(
        ClearCollect(colListOfModels, YourModelDataSource),
        ClearCollect(colListOfSeries, YourSeriesDataSource)
    )
  1. ddSeries Items Property

    colListOfSeries

  2. ddModels Items Property

    Filter(colListOfModels, series = ddSeries.Selected.Value)

This assumes two DataSources, two Collections and a Series identifier in the Models Collection.

Upvotes: 0

Nishad Up
Nishad Up

Reputation: 3615

Here is a simple solution without using Collections.

Step-1 Create two Dropdowns and rename them ddProductCat and ddProductSubCat respectively.

Step-2 Paste this line on the Item property of ddProductCat.

["Car", "Truck", "Van"]

Step-3 Paste below code on the Item Property of ddProductSubCat

If( ddProductCat.SelectedText.Value="Car",["BMW","Volvo", "Audi"],
    If(ddProductCat.SelectedText.Value="Van", ["Mersides","Volvo", "Toyota"],
        If(ddProductCat.SelectedText.Value="Truck", ["Toyota", "Tata"]
        )
    )
)

This solution is not recommended if you have bulk data or you may need to add/modify data in the future.

Upvotes: 0

emelayya
emelayya

Reputation: 31

To do that you will need to set up some collections to be used in your dropdown , and use condition to make the second dropdown change the values.

Example:

You can add a new button or use the visibility property of the screen and set these collections :

Collect(MyLetters, "A","B","C"); Collect(MyNumbers, "1","2","3");Collect(Roman,"i","ii","iii"); Collect(Dots,"a","aa","aaa")

1- In your DropDown1 , you can set items to MyLetters

2- In DropDown2 set items to the condition like this : If(Dropdown1.Selected.Value= "A",MyNumbers, If(Dropdown1.Selected.Value= "B", Roman, If(Dropdown1.Selected.Value= "C", Dots)))

Thanks,

Eman

Upvotes: 3

Related Questions