checkbox into an array

Servoy v4.1.4
OS X 10.6.3

Hi all,

I have a need to take multiple values from a checkbox field and create an array and do this over a small foundset of records

I seem to be failing miserably using the following code:

var v_fs_count = foundset.getSize();
	var v_array_result = new Array();
	var v_array_record = new Array();
	var v_string = null;
	for ( var i = 1 ; i <=v_fs_count ; i++ )
		{
		var v_current = foundset.setSelectedIndex(i);
		v_string = z_temp_column;//checkbox field
		if ( v_string )
		{
		v_array_record = v_string.split(' ');
		v_array_result.concat(v_array_record);
		}
		}

Any pointers to where I may be going wrong appreciated

Cheers
Harry

just curious: what other value than just 0 (or nulll) or 1 do you expect the checkbox to hold?

further: you already mentioned it’s a small foundset. Mind that this function will fail for foundsets >200 records.

try splitting on ‘\n’ instead of " "

Marc, if you have a TEXT field, with text valuelist, a checkbox can return (multiple) text also and they are seperated with a ‘\n’ AFAIK ;-)

Hi Marc

As Harjo mentions, there are multiple options for this checkbox field which is driven by a valuelist of (in this instance) suppliers for a product group
I want to multiselect the suppliers and create an array of their primary keys to cycle through and do something with them
Also, my foundsets are within 10 or so records here so very small and manageable

Hi Harjo,

Thanks, the ‘\n’ worked
All that I need to do is get my .concat() line working as it seems to be ignoring it :-)

Cheers
Harry

Harry Catharell:
All that I need to do is get my .concat() line working as it seems to be ignoring it :-)

That is because concat only returns the concatenation, it doesn’t change the original.

To get it working you should do this:

v_array_result = v_array_result.concat(v_array_record);

It works, but the multiple values are displayed in a horizontal way.
I would like to see the multiple values in a vertical way, and when there are a lot of values, I want to see those in values in multiple columns.
How can that be done?