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}