Define dynamic dependent DVelop Combos

 

The Dvelop Combo can be loaded dynamically, from a value defined in another DvelopCombo

 

For example, if we have Countries like "Canada", "México" and "Tailandia in a DvelopCombo, and we want to show only the Cities of each Country in another DvelopCombo, we can define two transactions as follow:

Two GeneXus Structure editor tabs are shown side by side: the Country transaction structure with CountryId, CountryName, and a nested City level containing CityId and CityName, and the DefaultDvelopCombo transaction structure with DefaultDvelopComboId, CountryId, and CityId attributes.

 

In the attribute CountryId we need to define the DvelopCombo and the property "Load Data Dynamically" in "true" as follow: 

The GeneXus IDE shows the DefaultDvelopCombo transaction with the Work With Plus pattern applied, its Default list preview displaying COMBO ID, ID (Value dropdown), and ID fields with Confirm, Cancel, Delete buttons; the Properties panel on the right shows Control Info settings for a Custom DVelop Combo control, including Data Source From Attributes, Item Values Countryld, Item Descriptions CountryName, Sort Descriptions True, and Load Data Dynamically True.

 

The attribute CityId must be defined with a condition when the attribute CountryId is the attribute to listen as follow:

CountryId = &Cond_CountryId

The GeneXus IDE shows the DefaultDvelopCombo transaction structure tree with the Countryld attribute selected, its Default list preview form, and the Properties panel displaying attribute settings for Countryld including Control Type DVelop Combo, Data Source From Attributes, Item Values Countryld, Item Descriptions CountryName, and Load Data Dynamically True.

The result is this:

A running Default Dvelop Combo form displays a General Information panel with a Combo Id field showing 1, a first Id dropdown set to Canada, and a second Id dropdown open showing a search box and dynamically loaded options Montreal, Toronto, and Vancouver, plus Confirm and Cancel buttons.