cancel
Showing results for 
Search instead for 
Did you mean: 
audrieg

SharePoint: Cascading Dropdowns in 4 Easy Steps!

Preparation (data sources):

 

I've decided to use two SharePoint Lists for this example. One as the app data source, and the other for the dropdown list values. Using a SharePoint list for my dropdown values enables end users to modify the form logic on their own. You could use any data source you prefer.

 

The control values list (named: Impacts)

Keeping it simple, I created a list called Impacts with two columns as shown below. Title (main request type), and SCategory (aka sub category - I didn't want to use any spaces or symbols there). The list is sorted by Title, Ascending. (I keep these in a separate list so that I can always show the same set of values in my dropdowns, even if there is nothing in the datasource for my app related to these selections.)

 

Impacts.PNG

 

 

 

The PowerApp List/Data Source (named: CR):

The SharePoint List that will collect the submissions from the PowerApp is very simple so as to facilitate this demo. It has three columns:

  • Change Impact (which is really just the Title column renamed)
  • Sub-Category (single line of text) - optional note: You could make this a choice list if users might be updating directly in SharePoint classic mode as well, only it can not be a multi-select choice list.
  • Answer (multi-line plain text field)

    You'll notice I entered 1 item/record manually using the regular SharePoint "New Item" command, that's just to make it easier to customize my forms. (It can be difficult to customize the forms until you have at least 1 record in the list. You can always delete that configiration record later.)

CR.PNG

 

Adding and Configurating the Dropdown Controls in 4 Easy Steps

 

OK. Now we're ready to have fun.....

 

Step 1: Generate a New Power App from the SharePoint CR List. PowerApps does most of the work for you, leaving you with a fully functional app with Browse Gallery, Display Form, and Edit/New Item Forms.

 

ribbon.png

 

dialog.png

 

Step 2: Add another connection to the app (Content Tab>Data Sources>(far right of screen) + Add data source) that references the "Impacts" list from the site as well. You should now have two data sources in your app, the one PowerApps added for you (destination data source), and the one you just added to the other list.

 

Tip: You can reuse data sources for controls by dedicating a CDS entity, or other data source like SharePoint for that purpose. For instance, I have a SharePoint site collection that is open to "Everyone except external users", where I keep a bunch of controls stuff - but CDS is perfect for this too! Just remember to permission the shared data source so that all users have the rights to read (but not write), and when using SharePoint also disable search results on each list so that the items don't come up in enterprise search results. Aren't you lovin' the fact that you can add additional data sources to your SharePoint PowerApp views so easily!?

 

AddImpacts.PNG

 

Step 3: Make some room above the gallery on the first screen and add a Dropdown Control (Insert>Controls>Dropdown), I named mine "ddSelectType". Set the "Items" property to Distinct(Impacts,Title) to get all the main topics from our Impacts list into that dropdown. Run to test (F5).

 

screen1.PNG

 

newdropdown.PNG

 

Step 4: We're almost done already! Let's make some more room and add another dropdown, which I named ddSubCategory. We will simply filter the ddSubCategory dropdown based on the selection from the first dropdown.

 

The Items property of ddSubCategory:

Filter(Impacts,ddSelectType.Selected.Value in SCategory)

 

Run and test! I just works!

 

 

CostWorking.PNG

 

I plan to share many tips on making your apps interesting, and incorporating data validation. Let me know if you'd like any particular topic and I'll do my best to make that happen for you! Keep visiting the Community because I'll be posting video demos with your popular questions asked as well.

 

Enjoy your PowerApps experience!

 

Audrie

Comments

@UB400 Here is the post I promised you! I hope you'll forgive me for the delay!

 

https://powerusers.microsoft.com/t5/PowerApps-Community-Blog/Conditional-Navigation-Triggered-by-Use...

 

Side Point: If you'd rather that they navigate to the other screen 'right after' the selection in the drop down, then move the "If()" function I explain in the above blog to the OnChange property of the drop down box.

 

Enjoy!

Audrie

I would like to add one more thing.. if you have repeated items in second dropdown you can enclose this Filter function with Distinct function like this Distinct(Filter(Impacts,ddSelectType.Selected.Value in SCategory), SCategory)

 

Greetings from Croatia

Vedran

@audrieg
I have exactly the same issue as @SanchezCSG. I have looked up the correct column name but still hasn't resolved the issue.

Any other suggestions on what can be done?

 

Thanks very much @audrieg! Yes this workek - you are a life saver! Thanks again.

 

May I also ask one more thing please. The cascading drop down works but I'd like the drop down to display as blank first when the user creates a new list item. At the moment, the drop down field displays the first item in the list straight away. I thought a workaround would be to add a "no value" item at the start of the list but this means I then need to add "no value" item in the other cascading drop downs and theres a lot! Is there a formula that I can add so that the drop down controls display a blank field first?

 

Thanks again

Hi @audrieg

 

I had a warning when creating the second dropdown, it says "Delegation warning. The highlighted part of this formula might not work correctly with column "fjsw" on large data sets. The data source might not be able to process the formula and might return coreect results or behave correctly if the data set is incomplete." And the part "ddSelectType" is highlighted and there is wave line under "in". Could you please take a look? Thank you!

2.png

 

 

 

Thank you Audrie, I managed to put it to work with the new method and the hints you gavee in this article, but unfortunatly I need this to work in a Document Library and although the dropdown works I am not uble to update the document item with th new edited dropdown values. It simply dosen't save the item. Can you help?