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

Cascading Dropdown without Datasource?

Hi, 

 

I was wanting to have a second dropdown with items appearing based on the items selected on the first dropdown. Looking into it, I have only seen ways to do this if you have the dropdowns linked to a datasource. Is it possible to somehow put in a function such as an IF fuction in the Items controls of the second dropdown without needing to use a datasource. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: Cascading Dropdown without Datasource?

You don't need a data source, you can define the items directly in the Items property. For example, if you have the first dropdown's Items property set to

["L1-1", "L1-2", "L1-3"]

Then you can have the second property set to the expression below:

Switch(
    Dropdown1.Selected.Value,
    "L1-1",
        ["L2-1.1", "L2-1.2", "L2-1.3"],
    "L1-2",
        ["L2-2.1", "L2-2.2", "L2-2.3", "L2-2.4", "L2-2.5"],
    "L1-3",
        ["L2-3.1", "L2-3.2", "L2-3.3", "L3-3.4"])

Or using the If function:

If(
    Dropdown1.Selected.Value = "L1-1",
        ["L2-1.1", "L2-1.2", "L2-1.3"],
    Dropdown1.Selected.Value = "L1-2",
        ["L2-2.1", "L2-2.2", "L2-2.3", "L2-2.4", "L2-2.5"],
    Dropdown1.Selected.Value = "L1-3",
        ["L2-3.1", "L2-3.2", "L2-3.3", "L3-3.4"])

View solution in original post

3 REPLIES 3
Highlighted
Advocate II
Advocate II

Re: Cascading Dropdown without Datasource?

@andy88 If you do not want to use a datasource you could hard code the listed items using table.  Here's an example:  

 

Create 2 dropdowns on the app (Dropdown1 and Dropdown2). 

 

For the forumula for Dropdown1 use:

 

Dropdown1.Items = Table({ID:1},{ID:2},{ID:3},{ID:4})

For the forumula for Dropdown2 use:

 

Dropdown2.Items = 

Switch(Dropdown1.Selected.ID
    ,1,Table({ID:"1a"},{ID:"1b"})
    ,2,Table({ID:"2a"},{ID:"2b"})
    ,3,Table({ID:"3a"},{ID:"3b"})
    ,4,Table({ID:"4a"},{ID:"4b"})
)

Now options presented on Dropdown2 will reflect which item is selected on Dropdown1.

 

Good luck,

Joey

Highlighted
Power Apps
Power Apps

Re: Cascading Dropdown without Datasource?

You don't need a data source, you can define the items directly in the Items property. For example, if you have the first dropdown's Items property set to

["L1-1", "L1-2", "L1-3"]

Then you can have the second property set to the expression below:

Switch(
    Dropdown1.Selected.Value,
    "L1-1",
        ["L2-1.1", "L2-1.2", "L2-1.3"],
    "L1-2",
        ["L2-2.1", "L2-2.2", "L2-2.3", "L2-2.4", "L2-2.5"],
    "L1-3",
        ["L2-3.1", "L2-3.2", "L2-3.3", "L3-3.4"])

Or using the If function:

If(
    Dropdown1.Selected.Value = "L1-1",
        ["L2-1.1", "L2-1.2", "L2-1.3"],
    Dropdown1.Selected.Value = "L1-2",
        ["L2-2.1", "L2-2.2", "L2-2.3", "L2-2.4", "L2-2.5"],
    Dropdown1.Selected.Value = "L1-3",
        ["L2-3.1", "L2-3.2", "L2-3.3", "L3-3.4"])

View solution in original post

Highlighted
Helper I
Helper I

Re: Cascading Dropdown without Datasource?

Thanks for the help. 

 

I was not too sure how to formulate the IF function but you have helped a lot. 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,407)