getValueListArray

I get an array using getValueListArray(“list”).
then I use it for a showSelectDialog question.
it works, but I can’t display this array, its length = 0 while the showSelectDialog displays its values fine?

Hi Lesouef,

lesouef:
I get an array using getValueListArray(“list”).
then I use it for a showSelectDialog question.
it works, but I can’t display this array, its length = 0 while the showSelectDialog displays its values fine?

You say you can’t display the array but you can with the showSelectDialog.
So how are you trying to display the array that doesn’t work for you?
What does your code look like ?

yes, the idea if to stop asking the question if the array is empty or with a single name in it.

code:
var $clients_array = application.getValueListArray(“clients”);
//test only
for (i=0 ; i < $clients_array.length ; i++ )
{ application.output ($clients_array*);*

  • }*
    *//other test *
  • var $len = $clients_array.length ;*
  • application.output(“longueur=” + $len );*
    var $answer = plugins.dialogs.showSelectDialog( i18n.getI18NMessage(‘sl.choice’) , i18n.getI18NMessage(‘sl.choose_customer’), $clients_array);
    I get a question with 3 options as expected, but the array length is still 0.
    by the way, if the array is empty, it displays a question with a single option “OK”. side effect? anyway I want to remove the question is the array is empty

Hi Lesouef,

Can’t you just use an IF statement to check if there is more than 1 client? Like so:

var $clients_array = application.getValueListArray("clients");
if ( $clients_array.length > 1 ) {
	var $answer = plugins.dialogs.showSelectDialog( i18n.getI18NMessage('sl.choice') , i18n.getI18NMessage('sl.choose_customer'), $clients_array);
}

Hope this helps.