Valuelist and global var problem

I am having difficulty with a global var (as data provider) when I do the following code:

var cat1_sql = '';
var maxrows = 100;
var calling_obj = 2;

cat1_sql = 'select screen_label, cat1_id from cat1 ' +
	'where is_active = 1 and call_obj_id = ' + calling_obj + ' order by cat1_order';

globals.dcm_debug_glob(globals.catWidget1);  // internal debug method in lieu of Debugger - global var ok here

var dataset = databaseManager.getDataSetByQuery('global_all', cat1_sql, null, maxrows)
dataset.rowIndex = 1;
globals.catWidget1 = dataset.getValue(1,2)
var nameArray = dataset.getColumnAsArray(1);
var idArray = dataset.getColumnAsArray(2);

// all of the var's and arrays above check out ok in the debugger ...

application.setValueListItems('cat1_sql', nameArray, idArray);

elements.cat_pick1.requestFocus()

The global var catWidget1 is a numeric intended to store the id’s being returned into idArray. When I run the above code and try to look at the global var catWidget1 in the onDataChange event, global var catWidget1 becomes a null.

Can anyone see what I am doing wrong? This is a very simple application at this point as it is within a separate method node and I am just starting on some reusable objects.

Michael

Ok … here are the conditions for a null in the global var data provider:

  1. If the code is bound to a TypeAhead field, the null condition DOES NOT appear (by “appear” I mean the value passed to the global var data provider)

  2. If the code is bound to a ComboBox (Editable = true) the null condition DOES appear regardless of whether one attempts to type something in or the operator chooses something from the sql-seeded valuelist

  3. If the code is bound to a ComboBox (Editable = false) then the null condition (data provider ret-val) DOES NOT appear - the Combo Box returns the user choice to the global var correctly.

Could someone from Servoy please comment: is this the expected behaviour of the setValueListItems function call? If so, in item 2 above, I am wondering how one creates an Editable ComboBox with a sql-seeded valuelist?

I have noted the 3.5 Help Screen documentation:

NOTE: If the COMBOBOX field (the “displayType” property setting) that you are filling a valuelist for is editable, only the first item in the array will be returned; if the COMBOBOX field is not editable, all items in the array will be returned.

Michael