Help with combo boxes

Help with combo boxes

Hellow, just started with Agile in the last week. Need some help and created a sample project to show my problem.
I have two similar problems shown in the example. I have two drop down boxes, one that is populated from a record from another table and one that is a Special List. I can populate the lists but I can't set the default value based on what is in the table. I have tried other things with the widget properties based on what is logical to me but I always get a data type error. Where I am thinking it should be set to the data type in that field ('text') it always errors with wanting an identifier.
In my other file(not shown) I can select a value and have it update the table, but in the example that doesn't seem to work either.
Appreciate any help.

Hi Ken,

First of all welcome to the OutSystems Community!

As for your problem, what you need to do is load into the variable that you set as the Variable property of the Combo Box the ID of the gender to be pre-selected on page load.

You currentry have this Variable property set to point at the Gender var, so you would need to set that to an existing ID in the screen Preparation action. Having said that, I believe what you really wanted here was to set that property to Testtable1Edit.Record.Testtable1.Id  so that the Save action saves the value the user selects here without you needing to assign Gender to Testtable1Edit.Record.Testtable1.Id explicitly.



Thank you for your response.

Should I be using an assign node in the Preparation? I tried that but still didn't have any luck. I tried adding that as you will see in the .oml. I know I am missing something fundamental here. Thanks in advance.


Hi Ken,
I've manage to correct your espace.

the problem was that you are assign the current value variable to the edit record widget Id instead with the current value of the record that you are seeing...

but is better to take a look.
if you want you can use the merge to check the diferences between you version and mine...

I also should advice you to change your data model to use the gender Id instead of the label.
like this.

Carlos Rocha
Hi All
Mr. Miguel Melo , Carlos
I think he can use OnChange technique ..? if it usefull explane it ..  just idea
Well, looking at your eSpace it seems the essential problem is that although your Testtable1 references both Gender and Sport you were doing so via a Text typed attribute. You should have these attributes as Identifiers (i.e. foreign keys) of their respective tables and let the DB and the platform do the heavy lifting. Then, when you GetTesttable1ById and feed that into your edit record, you can immediately use those attributes as the Variable properties for both Combos.

See the changed eSpace in attach. I cleaned it up a bit to show these changes but haven't tried it in runtime. You will notice that I removed the SelectOne record from the static property (it is best to have that as a special list option as I did than to dirty your model).

Let me know if this helps,


Thank you all for your help. You told me exactly what I feared. Reading and understanding the examples I noticed that they all use a foreign key in the tables. I am trying to design something around an old database on a SQL server that I reference. There are no foreign keys designed into the tables. None of the tables are explicitely. All of the tables for dropdowns then insert the text string and not the identifier into the second table.
So from what you all are showing me the only way I can use a dropdown filled from another table is to link the tables. So I need to create a new database with foreign keys in the tables and then re-create the reference?

Ah, that no-ForeignKey thing was not apparent on your previous messages or eSpace...

As for your question, no, you don't have to redo your whole model though for sanity and performance's sake it may be advisable. :)

Assuming that the foreign table is SportsTable (that, then, I assume only has an Attribute called SportName which I assume behaves as both a human readable text and a unique key of sorts) you can delete the Id attribute, make SportName the Entity's identifier (the OutSystems Platform supports Text keys) and take it from there.

On the combo you will have SportName as the Source Attribute AND, since it's also the FK, it will also be used in filling in Testable1's Sport on Save.

Again, thanks for the input. I have the database reference as an extension and it seems that with this setup that I cannot edit the structure of these tables at all. Is there some sort of switch that would expose the structure so I could change something about the table?
If not, then is it possible to make a change in the source database then re-import the reference without breaking everything I have setup so far?
I may need to start all over?

Hi Ken,

You can use integration studio to "improve" your database definition, for example to create foriegn key where there isn't one (using the Data Type column within the same extension). Its possbile also to remove some columns from the definition, if you want to simplified the integration.

Other option to change the definition if by using a database view, and afterwards to import it instead of the database table.

Paulo Garrudo
Thank you to all who helped with this problem. I recreated the tables of the project using foreign key identifiers and the drop downs created themselves perfectly. It was a case of bad data modeling from an old project.