noname in valuelist

I try to create a valuelist

var array = databaseManager.getFoundSetDataProviderAsArray(forms.contacts.contacts_to_contacts_join,'contacts_join_to_comemail.com_number');
array.toString()
var array2 =  forms.contacts.contacts_to_comemail.com_number ;
var dataset = array.concat( array2) 
application.setValueListItems('commNumber',dataset); 

//array returns [value1,null]
//array 2 returns value2
//dataset returns [value1,,value2]

but if one of the array’s has an empty(non valid) value, the list returns “noname” for it.

I think that the problem is the null in the first array, but I don’t know how to get rid of it.

Any suggestions?

Is that maybe a bug?

I tried creating a valuelist with an array with null-values, but I don’t see “noname”, it just displays an empty option in the list.

If you want to get rid of the null-values in your array, you can use a simple loop like this one:

for (var i = 0; i < array.length; i++) {
	if (array[i] == null) {
		array = array.slice(0,i).concat(array.slice(i+1));
		i--;
	}
}

Do you also see “noname” using an array without nulls?

btw, your var names are very confusing, “dataset” is an array and “array2” is a value :evil: :wink:

Thank you Joas,

it works great.