Introduction
In this Article, we will explore how to create cascading dropdowns using collections in PowerApps without relying on SharePoint lists.Cascading dropdowns are a valuable feature in PowerApps for creating dynamic user interfaces. While PowerApps provides built-in methods for cascading dropdowns using data sources like SharePoint lists, you can also achieve this functionality by utilizing collections.
Step 1. Setting up the Collection
So basically for creating cascading dropdown we have to create 2 collections, For this example, let's consider a scenario where we have a table named "Course" with columns "CourseID" and "CourseName", and another table named "Subjects" with columns "SubjectID", "SubjectName", and "CourseID".
Step 2. Adding data to the Collection
Course Collection
ClearCollect(
CollCountries,
{ CourseID: 1, CountryName: "IT" },
{ CourseID: 2, CountryName: "BCA" },
{ CourseID: 3, CountryName: "Comps" }
);
Subjects Collection
ClearCollect(
CollCities,
{ SubjectID: 1, CityName: "Data Structure", CountryID: 1 },
{ SubjectID: 2, CityName: "Mathematics", CountryID: 1 },
{ SubjectID: 3, CityName: "Java", CountryID: 2 },
{ SubjectID: 4, CityName: "Python", CountryID: 3 }
);
Step 3. Adding Dropdown Controls for Cource and Subjects
Insert two dropdown controls in your PowerApps app for selecting course and subjects,
Set the "Items" property of the cource dropdown to the "CollCourse" collection as you can see in below picture.
Similary, Set the "Items" property of the Subjects dropdown to filter the dropdown based on the Course dropdown and provide the required outocome.
Filter(CollSubjects, CourseID = CourseDrpdn.Selected.CourseID)
Output
Here you can see as i selected BCA so i am getting Java as a only subject linked with it.
Similarly, here you can see as i selected IT course so i am getting Data Strucure and Mathematics as a the subject linked with it.
Conclusion
In this article, we've learned how to create cascading dropdowns using collections in PowerApps without SharePoint lists.By manually populating collections with data from external sources, we can achieve the same dynamic functionality as with SharePoint lists.