Member-only story
Dynamic drop-down values for PowerApps
One of the most common questions when building PowerApps form is how can we dynamically change the value in a dropdown box when a user selects an option. This happens most often when we are designing forms that require country and state fields. In this article, we are going to create a simple dynamic/cascading dropdown, where the state values change based on the country selection.
Create two drop-down boxes and labels as shown above. For the first drop-down box, under the Items property, input
[“Cyprus”, “Hong Kong”]
In the second drop-down box, include this code in the Items property
If(Dropdown1.Selected.Value = “Cyprus”, [“Famagusta”, “Kyrenia”, “Larnaca”, “Limassol”, “Nicosia”, “Paphos”], [“”])
Now, when you select “Cyprus” in your country drop-down, your state value should change accordingly.
However, in most country and state drop-down fields, it would be time-consuming to write a list for every single country and an if-else for every different country. We need a better way to manage, thus, we are going to create a collection to store country and states. Collections are a way to…