How to cascade to 2 (or more) columns
Introduction
An example of how you can cascade a value to 2 or more columns.
Â
Assume you want to setup a 3 way cascade. The user should select continent, country , city (in that order),
Also assume you have a table listing all the cities in the world (worldcities) - containing 3 attributesÂ
Continent
Country, countryCode
City
Address
SolutionÂ
You can now setup a 3 way cascade as follows
gd.columns = continent, country, city, deliveryAddress
gd.ds = igrid_test
gd.tablename = locations
Â
Â
col.continent = Continent
col.continent.type = list
col.continent.query = select distinct continent from worldcities
col.continent.query.ds = igrid_test
Â
#
# Country column should only list the countries belonging to
# the selected continent
#
Â
col.country = Country
col.country.type = list
col.country.query = select distinct country, countryCode from worldcities where continent = {continent.value}
col.country.query.ds = igrid_test
Â
#
# City column should only list the cities belonging to the selected country
#
Â
col.city = City
col.city.type = list
col.city.query = select distinct city, zipcode, address from worldcities where countryCode = {country.value}
col.city.query.ds = igrid_test
Â
Â
#
# DeliveryAddress
# The delivery address is the delivery address associated to the selected city
#
Â
col.deliveryAddress = Deliver to
col.deliveryAddress.type = string
col.deliveryAddress.formula = {city.address}
Â
Â