Cascading dropdown in PowerApps


Posted By : Rakesh Pandey

Added :

31 Comments


In this blog, we will show you how to create a cascading dropdown in PowerApps using SharePoint custom list as a data source. If you are new to the PowerApps platform then you can go through this link to get started.

Create a SharePoint custom list.

In the below screenshot you can see that I have created a “States” custom list.

Cascading Dropdown Menu

Now we will create a new screen under PowreApps section as shown below and add drop down lists.

cascading dropdown in powerapps

Now we will bind the items to state drop-down list with SP states custom list as shown below.

SharePoint List

We will use the “Distinct(States,Title)” function to bind the items.

Here I am using a distinct function in order to get the unique column values.

Now we will bind the District drop-down with SP custom list on the basis of State selection.

PowerApps Advance Menu

Use “Filter(States,Title=StateDropdown.Selected.Result)” function to achieve this as shown above.

Complete the above steps and preview the App in order to see the result. It looks like something given below.

State DropdownDistrict Dropdown

We saw how to implement cascading dropdown in PowerApps. You can make the default value as null or blank if you want. We will see in our next post how to make the default value as null or blank.

Thanks for visiting my blog. Please share and subscribe to our site for more stuff on PowerApps.

0 0 votes
Article Rating
Subscribe
Notify of
guest
31 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
sudhakar
sudhakar
3 years ago

Hi sir,

in the above statement district dropdown advanced under item values Distinct is not getting for me what i need to do . please guide me

Imesha
Imesha
3 years ago

Hi,
I followed this example and created a list and a powerapp for that list. I created two drop down columns in the list and applied the Distinct function for the first drop down and it worked. When I tried to apply the Filter function for the second formula, it does not work and it does show any errors either. Also the Value tab is also not visible maybe because I used a sharepoint list dropdown rather than going for a dropdown in powerapp. Can you please explain what possibly can be done?

hita
hita
3 years ago

Nice tuto: I was looking for little advance one; What if we need multiple selection cascading combo box or list box.
suppose: combobox1 : (Fruits,Hardware,Furniture)
combobox2: If i choose fruits and all the items related with fruits should show and if i choose fruits & hardware then all the items related with fruits and hardware should show and can select as per my choice and save.
Also i must able to view and edit..
is it possible?

vislaga
vislaga
3 years ago
Reply to  Rakesh Pandey

Hi Rakesh,

If you don’t mind, could you please let me know steps to create cascading combo box.Is combo box a SharePoint lookup field (with allow multiple values) or have you set a Powerapp datacontrol ?

Also once you populate it to datatable , if I want to save one specific column to SharePoint field, how can I do that ??

vislaga
vislaga
3 years ago
Reply to  Rakesh Pandey

Thank you Rakesh !! I will try that option.

hita
hita
3 years ago
Reply to  Rakesh Pandey

Hi Rakesh,
I tried to follow the example but it did not work as expected.
As i said: i have two combobox and Items List having column ‘stuff’ in which i have fruits, fruits ,hardware, hardware, furniture, furniture.
and ‘related’ column in which i have apple,orange,iron,Nail,chair,box
combobox1 : (Fruits,Hardware,Furniture)
combobox2: Apple,orange,Iron,Nail,chair,Box

now if i select fruits and furniture in combo 1 then in combo 2 i should be able to see the option Apple,orange,chari,Box.
AND I should able to save the selected items also i should be able to update.

i succeed in cascading but unable to SAVE AND UPDATE.
is this possible??

hita
hita
3 years ago
Reply to  Rakesh Pandey

Hi Rakesh,
Yes i want to save in sharepoint list.
I can cascade but i am not able to save or update..

Plz see the shot: https://ibb.co/3Ngw1GL

KVBharat Bhushan
KVBharat Bhushan
2 years ago

Hi in my Power App Application I have created a Main List say Employees with Country,State,City Look up dependency from a Country Master List. Now I developed a Cusomized PowerApp Employees list with Country,State,City Datacards[hidden mode as of now] taken from Country Master datasource and assigned Country,State,City Drop down values. Please tell me what should be the Default, Items, OnSelect, OnChange and any other Advance Property values if required for all the above 3 mentioned Country,State,City Datacardvalues and also Dropdown values. Here I am loading 2 DataSources: Employee Main Form, Country Master for Cascading Dropdown inputs. So please give me a clear detail sample explanation on this.

Navin
Navin
2 years ago

Hi Rakesh.

Thank you for the post.

I’m facing an issue at “StateDropdown” in the “Filter(States,Title=StateDropdown.Selected.Result)” function.

My list name is “Platform” with 2 columns

Title is renamed as “Selected Vendor”

The second column name is “Platform”

In PowerApps:

On Selected Vendor Items, I’ve used Distinct(Platform,Title) which is working fine.

On Platform Items, I’m facing issue.

Can you please help me with this?

Regards,
Navin.

Navin
Navin
2 years ago

Thank you very much for your assistance, Rakesh.

It’s working now with your help.

Regards,
Navin.

Bala
Bala
2 years ago

Hi Rakesh,

Thanks for this tutorial , I have couple of questions.

1, In my case i have 3 drop down lists to create in power apps . The first Dropdown 1 has say Countries (India , US etc.) the second drop down has States (TN, UP etc.) . So when i put a country , i will need to show all states in that country , then when i pick a state say TN in drop down 2 , i should populate Chennai , Ooty in dropn down 3 . How can i accomplish this.

2. Not sure if you have worked on this . I built a form in power apps and uploaded a file with some metadata to sharepoint library through flow . The file is uploading to SP but its creating 2 versions of the document in SP which is not right . The ver 1 is blank and the 2nd ver has metadata . How can i resolve this issue ? is there an action in the flow which we need to configure to get only 1 version of the file in sharepoint ?

Any help on this is appreciated.

Thanks

bala
bala
2 years ago

Hi Rakesh,

Thanks for your support. No 1 works and No 2. i figured its a sharepoint feature itself when i tried to load a file in sharepoint directly without metadata it created version 1 . if i upload the file with metadata its creating 2 versions so the ver 1 is a dummy which is ok for me.

Thanks

I have another question , i am creating a form in power apps to populate information of 10 columns from sharepoint library . I have 10 text input fields on the form. When the form is connected to SP library datasource , user enters EMP ID in the first text input field rest of the values corresponding to the emp id should popukate in the 9 text input fields. Can this be done ?

Thanks

bala
bala
2 years ago

Thanks Rajesh,I should have posed by question little more clear .

Yes, i have a data source (sharepoint library) . The library has 3 columns say (Emp ID, Emp Name, Emp Dept Name).

The Power App Form should look this . When user inputs Emp ID value in Text Input 1 field and hits the Search button (should connect to the datasource (share point library in my case) and retreive values of Emp Name and Emp Dept Name from sharepoint library for the Emp ID and populate the power app form fields text input 2 and text input 3.

What are the details to get this accomplished . In this case i think should we be applying the filter function on the search button ?

i am not able to paste the image of my sample form here.

Regards

Bala

Bala
Bala
2 years ago

Thanks Rajesh.

I tried the function and i am getting an error

UpdateContext({DocumentTypeVar:First(Filter(Collection1,ProductType=Value(TextInput1.Text,”es-ES”))).DocumentType})

Error : Expected Operator. We expect an operator such as + , . or &

In this case of my form , text input 1 is ProductType to enter during runtime and DocumentType should populate in text input2.

By the way what is this reference : “es-ES” and also if i want to expand on populating more columns from the sharepoint library , how would the formula syntax be ?

Dana
Dana
2 years ago

I have an SP list where I am using Customize Form. Was able to get the cascading dropdowns to work for a single department’s choices. I have a Cascading Drop Down list which has 3 columns
Title (Group) they choose their group
Discipline (shows 5 different group choices)
Assigned (shows the person’s name)
I need to add a dropdown in the form now for people to choose a department and then have it show the appropriate choices for THEIR department. I tried creating a new Cascading list that had 4 columns
Title (department)
Group – this now showed every choice in the group column
Discipline – showed all disciplines
Assigned – had the person’s name listed mutiple times

Is there a way to use a single list for both Departments and have it filter out just showing the appropriate choices for them?
Thanks for any words of wisdom you can provide.

Imran
Imran
2 years ago

Hi, is there a way to set default value in cascading drop-down? For example.. if you have three fields, Field A = A, B, C Field B = Red, Green, Yellow and Field C = Banana, Mango, Orange .. so the idea is if you select an item from field A, fields B and C should stay blank until user click to pick but still do the cascading? thank you

Darren
Darren
1 year ago

Hi Rakesh,

Great tutorial. In fact I used it to implement my own cascading dropdown however I am facing an issue where I have a gallery and am populating it with the results of my cascading dropdown.

How do i filter the results to exclude the results where the third column is blank ?

My expression is : Filter(colRiskRegisterSource, RiskCategory = cbxRiskCategory.Selected.Result && RiskGroup = cbxRiskGroup.Selected.Result) and this is working fine but in some cases the results may return and empty item. I want to filter that out. Any idea ?

Thanks