Populating a form through the Solution Model

Hi,

I have a db table with a set of data. In my form, for each of the values, i need to create a check box and set the value (in the table) as its label .
So I used the solution model.

elements.tab_main1.removeAllTabs();
var state = history.removeForm(‘frm_accessory_tab’);

var _form = solutionModel.getForm(‘frm_accessory_tab’)

for(var _i=1 ; _i<= _fs_accessory_spec.getSize() ; _i++){
_fs_accessory_spec.setSelectedIndex(_i);

_check[_i] = _form.newCheck(_ds_check[_i],_x,_y,_check_width,_check_height);

_lbl[_i] = _form.newLabel(_fs_accessory_spec.accessory_category_name,_lbl_x,_lbl_y,_lbl_width,_lbl_height);
_x += 110;
if(_x >= 500){
_y+= 20;
_x = 10;
}
_lbl_x += 110;
if(_lbl_x >= 500){
_lbl_y += 20 ;
_lbl_x = 30 ;
}
}

The problem is how to deal with the data provider. I used an array, _ds_check[_i], to set as the data provider for the check boxes. But when I try to print the value of the array’s elements, I get NULL.

So my question is,
Have I used the solution model correctly? If not, what is the way to set the data provider and access its value (in this case a 1 or 0)?

Thanks in advance.

Regards,
Hareendra

where are all those variables come from? (like _fs_accessory_spec and _ds_check)

HI,

_fs_accessory_spec is a foundset of the table which has the data that I want to use.

_ds_check is an array (form level) that I used to set as the data provider for the check boxes being created

_check is another array that I used to set as the variable for the check box

_x is the variable i use for the x - coordinate
_y,is the variable i use for the y - coordinate
_check_width is the width of the check box and _check_height is the height of the check box

Regards,
Hareendra

hareendra:
_ds_check is an array (form level) that I used to set as the data provider for the check boxes being created

form level? which form? Not of the form that you are touching in the solution model?

Else how do fill that variable? If they contain null then it is just empty…

Hi,

I didn’t quite understand what you meant. The array is declared as a form variable of form A. The form I’m trying to add the check boxes to is form B.
My problem is how do i set a data provider.

_check[_i] = _form.newCheck(_ds_check[_i],_x,_y,_check_width,_check_height);

currently the data provider is _ds_check[_i]. Is this correct?

yes but how is _ds_check filled?
If you say that the contents of that array is null?

Because what should be in _ds_check is a String or a JSVariable.

HI

I assume, since _ds_check is the data provider, it is filled when the user, checks the check box(es)

Regards
Hareendra

ahh so you have build a field on form a that has that _ds_check as it dataprovider?
But what do you expect how that array is filled?
Because i see in your code that you expect that array to be the same size of the _fs_accessory_spec foundset?

Is it build on single checkbox or a checkbox with a valuelist?

Looking at your code you seem to asume that every record of the foundset also represents a indexed value in your form variable array?

this will not work. The formvariable will just hold a boolean yes or true for the checkbox on the the form no matter what record it will display
Or if it is a check field with a valuelist, it will hold a string with the selections that are done (on the form not depending on the record)

Form variables are one single value not depending on foundset or (selected) record