How to change the data type of a valuelist

I created a valuelist with numbers like
0
30
45

Now I got this message in console:
Valuelist: vl_lunch_break_duration used with different types
The valuelist was already created for type: NUMBER
for the dataproviders: _tw_lunch_break_duration
So it can’t be used also for type: INTEGER for the dataprovider: ps_tw_lunch_break_duration
Please check these dataproviders of this valuelist: vl_lunch_break_duration

I have two questions regarding this:

(1) Is it possible to explicitly set and change the data type of a valuelist? (As in the valuelist edit form there is no data type field)

(2) _tw_lunch_break_duration is a JS variable, and in JS there is no data type integer but only number
Now I have also the table-field ps_tw_lunch_break_duration, and created it as an integer.
When I want two listboxes with the above value list, one for _tw_lunch_break_duration and one for ps_tw_lunch_break_duration,
does it mean I need two different value lists with type number respectively integer, to avoid that red message in console?

It seems Servoy sets the data type of a valuelist at runtime, when the form with the combobox and its valuelist is shown.

So when one combobox has a dataprovider with type Number, and one combobox has dataype Integer, as in my example above, I get always an error message when I show the other combox after the first one.

I created now two identical valuelists with different names like
vl_lunch_break_duration_integer
vl_lunch_break_duration_number
and attached them to the dataproviders with the respective data type, and the red console message is gone.

Your variable is a form/global variable, right?
For those there is a distinction between integer and number. You should be able to change the type of your variable and use one valuelist.

Hello Joas,

thanks for your hint, that worked. I changed variableType from 8 to 4.
I remember Gary once told me you have create a var like

var _tw_lunch_break_duration = 0 (gets variableType 4 = integer)
var _tw_lunch_break_duration = 0.0 (gets variableType 8 = number)

and then you get the correct type.
After you get the properties section, you can set the assignment to null when needed.

/**

  • @type {Number}
  • @properties={typeid:35,uuid:“30863065-AD01-4847-A0D4-3E971F7AFF0F”,variableType:4}
    */
    var _tw_lunch_break_duration;

Note that there is also a gui to create/change variables:

[attachment=0]variable.png[/attachment]

Thanks, that’s even better to change the data type of a var.