+91 – 88617 28680learning@flexmind.co

Cascading Dropdown in PowerApps

26
Jul

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

  1. Create a SharePoint custom list. In below screen shot you can see that I have created a “States” custom list.

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

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

4. We will use the “Distinct(States,Title)” function to bind the items. Here I am using the distinct function in order to get the unique column values.

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

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

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

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 our site for more stuffs on PowerApps.

Comments

  • sudhakar
    October 11, 2018

    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

    • Rakesh Pandey
      October 12, 2018

      Hi Sudhakar,
      Distinct is a powerapps fucntion which evaluates a formula across each record of a table. Distinct returns a one-column table that contains the results, with duplicate values removed. It should come automatically in the formulae (fx) textbox automatically. Can you share your formulae.

  • Imesha
    January 11, 2019

    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?

    • Rakesh Pandey
      January 11, 2019

      Hi Imesha,
      Can you create a powerapp drop down and use the filter function on it to make sure whether it’s working or not. And also can you share the screenshot of your existing formula used in PowerApps studio.

  • hita
    February 19, 2019

    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?

  • Rakesh Pandey
    February 19, 2019

    Hi Hita,

    Thanks for visiting our blog. Yes, it is possible to filter items based on cascading dropdown or Combobox. In this example we have a list with the name ‘Product Sales’ which has SalesOrderNumber column. we are selecting multiple salesordernumber from combo-box and showing item details in a datatable. I have written this formula for datatable items Filter(‘Product Sales’,SalesOrderNumber in ProductsComboBox.SelectedItems.SalesOrderNumber)

    PowerApps Combo-box filtering

    • vislaga
      March 10, 2019

      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 ??

      • Rakesh Pandey
        March 20, 2019

        Hi Vishnu,
        My Apology for delayed response.
        Yes we can create a cascading dropdwon using sharepoint look up field.
        For example, see in below screen shot state and district values are coming from a sharepoint list.
        Cascading combo box
        Formula used to show the State value is Distinct(States,State)
        Formula used to show the District is given below.
        Items = Filter(States, State in ComboBox1.SelectedItems.Result)
        DisplayFields = [“District”]
        In my opinion instead of using datatable, you can use gallery to save data to SharePoint.

        • vislaga
          March 20, 2019

          Thank you Rakesh !! I will try that option.

    • hita
      March 19, 2019

      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??

      • Rakesh Pandey
        March 20, 2019

        Hi Hita,
        As I suggested vishnu in my below comment that we can use gallery to save and update the data. Can you let me know exactly where you want to save these details, in SP list or somewhere else ?

        • hita
          March 21, 2019

          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

          • Rakesh Pandey
            March 22, 2019

            Hi Hita,
            Pls see the screen shot of an example below.
            Save Sp Item
            Formula used in this application are:
            Add Icon on select : Collect(Repeating,{Name:TextInput1.Text,Employeeno:TextInput1_1.Text,Supervisor:TextInput1_2.Text});Reset(TextInput1);Reset(TextInput1_1);Reset(TextInput1_2)
            Cross Icon on select : Clear(Repeating)

          • Rakesh Pandey
            March 22, 2019

            On borad button on select : ForAll(Gallery2.AllItems,Patch(EmpOnboard,{Title:TextInput2_1.Text}));Clear(Repeating)
            EmpOnboard is a sharepoint list.
            Remove All Items on select : Remove(EmpOnboard,Gallery3.AllItems)
            May be this example will help you in building your application.

Leave a Reply