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.
Solved! Go to Solution.
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"])
@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
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"])
Thanks for the help.
I was not too sure how to formulate the IF function but you have helped a lot.
User | Count |
---|---|
139 | |
132 | |
75 | |
72 | |
69 |
User | Count |
---|---|
214 | |
196 | |
64 | |
62 | |
54 |