Multiple column Combobox

Multiple column Combobox

  
I want to display 2 attributes of an entity in a combobox. For instance ID + " : " + DESCRIPTION , where the ID must be stored in the database.

Is this possible and how?

Greetz, Dick Dokter
Hi,

Is not possible on the current version of Outsystems to show a combo box with multiple columns, but that will be a good feature for future versions of platform.

Nelson Inácio
Hi,
You can do this by the following approach.
I am considering your entity as country, with the two attribute ID(integer),CountryName(Text).

Define a structure

str_country with two attribute ID (country identifier), DESCRIPTION (text 100)

Drag and drop the advance query widget in the preparation event, And add the str_country as the
output Structure.


Construct the following SQL statement, And Place it in the SQL TAB of the advance query widget

SELECT ltrim(ID)+':'+ltrim(CountryName) DESCRIPTION ,ID FROM {Country}

Verify and Test. you should not see any errors. Name the Advance Query as AdvQry_Country (Just for Namming)

After this,

you have to set the following values to the combo box properties.

Variable = var_cboval (This variable will be of the type "country identifier")
Source Recordset List = AdvQry_Country
Source Entity / Structure = str_country
Source Attribute = DESCRIPTION
Source Identifier Attribute = ID


After this it becomes like a regular Combo.

you can have your own code to save the selected value in the database

You can do this for any table and bring any combination of attributes
NOTE:
Your SQL Statement should be propositional to the output Structure.

I hope it help's you .

Praburaj Vishvanathan(Prabu)
Logica
Prabu,

Thanks for your help.

I used it several times in my eSpace now, with succes.

It works perfect.

Dick Dokter