cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
andy88
Level: Powered On

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
PowerApps Staff CarlosFigueira
PowerApps Staff

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
keathley
Level: Powered On

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

PowerApps Staff CarlosFigueira
PowerApps Staff

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

andy88
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 350 members 5,826 guests
Please welcome our newest community members: