Languages: Java, .NET, .NET Mobile
Objects: Transactions, Work Panels, Web Panels
Controls: Dynamic ListBox, Dynamic ComboBox,
Interfaces: Win, Web
Creating friendly user interfaces is one of the main challenges faced by developers today, as modern applications require increasingly sophisticated data entry features. Among other things, an application's usability depends on how easy it is for users to enter data.
In this context, some scenarios that were difficult to implement when coding by hand can now be easily implemented with GeneXus .
The most typical example is the Country and City combo boxes, where the City combo box must show the cities of the country selected in the Country combo box.
Example
if you have the following:
The result will be as follows:
The cities displayed match the selected country.
The navigation shows the following:
FILL CityID with CityID, CityName in
=CITY( CityID, CountryID) INTO CityName CityID
Where CountryID = CountryID
Order CityName
In general, if we have the following structure:
One combo box defined in B depends on the value selected in A, in a transaction containing A and B.
In some cases, tables are defined as follows:
Trn: Country
CountryCod*
CountryName
Trn. City
CityCod*
CountyCod
CityName
In this case, we can't use the automatic filter function in dynamic combo boxes because the country is inferred from the city, and it isn't editable.
In some cases, Dynamic Combos that worked fine can change their behavior. The problem is that combos with subtypes aren't well defined.
For example:
CustomerCod*
CustomerNam
SalesCustomerCod
SalesCustomerNam
Customer Subtypes
SalesCod*
SalesCustomerCod -> Dynamic Combo (SalesCustomerCod, SalesCustomerNam)
The dynamic combo should be based on the supertype (CustomerCod, CustomerNam) and not on the subtype (SalesCustomerCod, SalesCustomerNam).
Note of compatibility (IsValid event triggering): Since GeneXus 9.0, Win applications have a different moment in which the IsValid event is triggered, depending on the control. For the Edit controls the IsValid event is triggered when exiting de field (as in GeneXus 8.0 and previous versions). For checkboxs, listboxs, combos and radiobuttons, this event is triggered when a value is selected in the control.
Being able to define the conditional load of a combo box is a great advantage. For this reason, we have a new property called Condition.
Example:
Suppose that you need a web panel or work panel to behave as a transaction. To do so, you can add variables based on CountryID and CityID, defined as dynamic combos, and define &CityID by country.
Sometimes, a dynamic combo box can load records depending on other attributes, when there aren't any direct relationships. In this case we can use the new property called "Instantiated Attributes."
Example:
In a multi-company system we have a table with all products, and another table with all the products that the company can sell. For that reason if we have a products combo box, we can only see the products of the instantiated company.
Consider the following transaction:
And the following relationship:
If we define Product as a Dynamic Combo, we need to see the instantiated company's products. This isn't the default behavior.
To define that the products are only those that the company can sell, we must indicate it in the new property "Instantiated Attributes."
The navigation is as follows:
FILL ProductID with ProductID, ProductName in
=ENTPROD( ProductID, CompanyID) INTO ProductID CompanyID
=PRODUCT( ProductID) INTO ProductName
Where CompanyID = CompanyID
Order ProductName
The Empty Item check allow to define an empty value. In general case we use this to describe the combo (i.e. "Select a Country").
Attachment