Default value for comboBox (DB valuelist)

Hello,

How to set default value when combbox is filled with Database Values based valuelist?

For Custom Values based combobox’s valuelist:
I placed a combobox on form and attached valuelist to it.
Filled valuelist with Custom Values:
Folder
File
Directory
Other
I went to the dataProvider and opened the appropriate db table;
Then on the bottom found: Details, Auto Enter, Validation, Conversion
On Auto Enter tab i choose Custom Value “Folder”, and that is the default value in my combobox from now on

Here comes my question: How to set default value for Database Values based valuelist?
I’ve tried with Auto Enter->System Value database managed
Is this a bug in Servoy4: when i chose Auto Enter->Database Default i’m not able to save the changes?

Waiting for your guidelines

Regards

that shouldnt be any different then with custom

The dataprovider and its default value is just the same.

And database or custom value, thats just the source where the selection value’s must come from.

You only need to make sure that the default value is in the list (custom or db)

Thanks for your reply, jcompagner!

But if solution switches to another DB, i have no idea which values will be read from DB so i’m not able to hard-code the default that way?

Is there sg like setindex from db based valuelist as default?

Regards

It should be if possible in the list.
But if you use none editable combobox where the value is not a id|string value, but it maps on 1 column then it will show that default value as selected (but it isnt in the list)

For other valulist that are id|string onces what you can do is make a fallback valuelist that holds your default value and set that as a fallback valuelist on all the db valuelists.

Hi Tokajac,

I have an idea ( but is an home-made idea,not very elegant):

You can put a form-variable under your combox,so you can update it by code with the value that you desire.
By hard-coded value(for example on onShowEvent) or by the db(for example you can update the form by the onRecordSelection).
However I don’t know what you really need but maybe a form-variable can be a solution.