Move data from one ValueList to Another ValueList

Hi,

Is it possible to move data from one valueList to another.

I’d like to do something like the one below:

  1. Get data from valueLists
    var valueListContentsArray = //get data from valueList1
    var anotherValueListContentsArray = //get data from valueList2

  2. Set all array to one valueList
    combinedValueList = combineArray(valueListContentsArray, anotherValueListContentsArray) //combines the array of information taken from step 1
    application.setValueListItems(combinedValueList); //assigns it to valueList 3.

Assuming valueList1 is taken from “Table Values” and valueList2 is taken from “CustomValues”.

Is this possible?

Thanks!

this depends on what the original valuelists are based.
Can you give some more background info on this?

mboegem:
this depends on what the original valuelists are based.
Can you give some more background info on this?

Original valueLists (producer) are based on table values and custom values, which are created in Servoy IDE UI.
The third valueList (consumer) will populate it’s data during runtime.

erikd:
Original valueLists (producer) are based on table values and custom values, which are created in Servoy IDE UI.
The third valueList (consumer) will populate it’s data during runtime.

you mention table values: as long as they are not related, you can use this to get a dataset of the content of the valuelist:

application.getValueListItems('producer')

So if you have 2 dataset, you either:

  1. merge them into 1 new dataset.
  2. extract arrays from the columns and concat the arrays, using those to populate the new valuelist.

As soon as you use a relation to get to the valuelistvalues, the getValueListItems function won’t work as it is executed ‘without scope’
I can image that it will work when a global relation was used, but I didn’t test this.
The same applies to valuelists using a global function.
This is shortly documented in the function itself.

Hope this helps!