The Suggest property applies to Edit controls and can be used in transactions (attributes) as well as in Web and Work panels (variables). Enabling the Suggest property in an Edit control will cause a list of possible values for that control to be displayed when entering data. The suggestions list can be calculated in an incremental way (the list is updated as the user enters data), or by making requests (the user manually makes a request to calculate suggestions). The list updates are asynchronous and calculation times depend on the quality of the connection.
The Suggest property can be enabled over Edit Controls themselves or over attributes. If it is applied to an attribute, the Suggest property will be enabled by default everywhere the attribute is used. On the other hand, the suggest property can be only used over char or varchar attribute or variables, otherwise spc0112 ("Item value %1 for control %2 must be Character or VarChar") specification error will be shown.
This property is independent of the InputType property. However, it is advisable to read the InputType property documentation first because using both properties will make it easier to create friendly user interfaces. Read more information about how these features can work together.
Let's consider the Countries and Clients transactions, where all Clients belong to a Country.
The "traditional" way of entering data requires that once the Client name and identifier have been entered, the Country code must be entered by inferring CountryName. In order to avoid that, InputType = Description is set to allow entering CountryName instead of ClientID.
In addition, if Suggest is enabled for CountryID, a list of suggestions will be displayed with possible attribute values when entering data.
Finally, the result of enabling the Suggest property will be the following:
Conditions allow you to limit the set of possible values to be entered. To do so, you only need to configure the Condition property as follows:
At runtime, if the value entered doesn't match the condition, a "No matching <table>" message will be shown. In the example above, the "No matching." message would be shown when not entering a country which name begins with "U".
When inserting a condition, it is possible to use attributes of the extended table of the "Value" (or Description) attribute. E.g.: In the example shown above, if Country would have a foreign key to e.g. "Continent" it would be possible to use the "ContinentName" attribute in the conditions as it can be inferred from CountryId.
The set of possible values displayed by the suggestion list can also be limited through the Instantiated Attributes property. This property is used to filter the set of attributes depending on other attributes that can't be inferred directly. Let's consider the following 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. Therefore, if we have a products combo box, we can only see the products of the instantiated company.
Consider the following transactions:
And the following relationship:
If we enable the Suggest property for ProductID, most likely we will only want to enter products that belong to the selected company (that is to say, the products instantiated by this company). To define that the allowed products are only those that the company can sell, we must indicate it in the new "Instantiated Attributes" property.
The suggest property can be used over attributes in transactions (as seen above) or it can also be used over variables either in transactions, work panels or web panels. When enabling the suggest over a variable, after the focus reaches the variable (at runtime), a list of values will be unfolded suggesting the stored values for the attribute set at the "ItemValue" property.
This would be useful in cases where you would want the form to "remember" the stored values in the database as they are frequently used, but you also want to allow entering new values for that field.
- Currently, the Suggest property always works in an incremental way. Therefore, regardless of the selected value ("Incremental" or "On Request"), it calculates the suggestion incrementally. The distinction between "Incremental" and "On request" will be included in the future.
Attachment
Languages: Java, .NET, .NET Mobile
Objects: Transactions, Work Panels, Web Panels
Interfaces: Win, Web
Input Type and Suggest working together
InputType property
Official 'GeneXus and Ajax' site
Sample to see ajax features running online
Sample KB to download
More information about AJAX