List Control - Cascading Lists, Part 1

UX Component

In this document and accompanying video we will discuss how to create cascading lists on the UX Component. 


Watch Video - Part 1


In the example below we have a UX Component with two lists that are populated by the Northwind customer table.  The first list is a list of countries, and when one is selected the second list of cities is filtered based on the value of the selection in the first list.  So the second list of cities has a parent list, and we have created what we call a cascading series of lists.  There is no limit to the depth of the cascade that we can create.


(Note: Northwind is a sample Microsoft Access database that is shipped with Alpha Anywhere.  It can be found in the 'MDBFiles' folder in the folder where Alpha Anywhere is installed):




Like any other control this could be put into a repeating section.  Click on the Design tab, then choose RepeatingSection under Subtype:




When we click on the Working Preview tab we see our cascading lists repeated down the page.  Each row is independent of each other, and we can easily add another repeating section by clicking on Add new row at the bottom:




But let's keep it simple for now, and turn off RepeatingSection by choosing None for our Subtype:




We can define our cascading lists by clicking on our first list, [list_countries], then List properties:




We see that the list is based on a SQL data source, and our connection string is going to Northwind.  Click on SQL statement to learn more about that:




Our SQL statement is getting a distinct list of countries from the customer table, and it is ordered by country.  We have not specified a filter for this list:




It is also important to note that we have defined an argument.  Click on Arguments to bring up the Define Arguments window:




We have defined the argument as whatcountry, and set the Value of this argument as {list_countries} which is the List Control that we are currently defining:




We have also specified that this list should return a Field value, and the field value should be Country




This means that every time we make a selection in the list, the argument, whatcountry, will get populated with the current value.  At runtime we see that when we click Canada in the first list, that argument gets populated automatically in the second list:




Now let's look at how we define the second list.  Click on the Design tab, then [list_Cities], then List properties:




We see that this is also based on a SQL data source, coming from the Customer table:




Click on SQL Statement to see that our SQL statement this time is SELECT DISTINCT City from the Customers table, again ordered by City.  For this list we have a filter that says WHERE Country =, and the argument is :whatcountry, which is the argument being set by the parent list:




We have also specified that the second list Has parent list, and that Parent list id is list_countries:




By specifying the filter, the arguments, and by turning on Has parent list we have automatically turned this second list, list_Cities, from being a stand-alone list to being a dependent list whose choices are based on the current selection in the first list, list_countries: