global-backed valuelist of DB table values

I think I’ve isolated this oddity, but it is really “odd” {:frowning:

It’s perhaps best described by first noting two scenarios where valuelists do work “as expected”:

(1) A form field with a dataprovider being a global and having a valuelist being a set of values listed in the valuelist: I can set the global and when the form is displayed that value is displayed in the field, regardless of its position in the valuelist :-)

(2) A form field with dataprovider being a db field and having a valuelist being a set of values from a DB table: again I can set the dataprovider and when the form is displayed that value is displayed in the field :-)

I guess you know what word comes next: “BUT”…

With a form field with a dataprovider being a global and having a valuelist being a set of values from a DB table: no matter how I set the global dataprovider, the form is displayed with a blank in this field :-(

“Why are we doing this?” ;-) Quite simple really: we want the operator to be able to choose a value from a pre-defined set, and often we can set a “likely” value as default - if this works just fine then for those “likely” cases the operator doesn’t need to mess with that field. Sometimes the field is not a DB field, so a global is needed (Grumble: because we don’t have the option of a form-local non-db dataprovider). Rather than hard-coding these valuelists in the solution, it’s more flexible to make the list table-driven.

Thanks,
Neale.

I do exactly the same. I have a global with a value list that is generated onShow of the form (the value list dependes on the form where it is needed). At first, there were some problems in the early betas of 2.2. Now, it seems to work here. I create the value list and then set the default value and it shows up nicely.

What version are you using and how does the code look like at the point where you generate the value list and set the value?