Graeme6630509
Posts: 0
Joined: Sun Feb 02, 2014 5:26 pm

Save array as multiple rows in collection

i am trying to add two values into a collection. one is a number, the other is an array. I would like a new row for each value in the array

e.g. number: 1 array:[1, 2, 3]
Collection:
col1 col2
1 1
1 2
1 3

Is this possible? If it helps the array values are being taken from a checkbox.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Save array as multiple rows in collection

Hello -

No, you would need to parse your array and update data in collection programmatically.
:: http://docs.appery.io/documentation/b...
:: http://docs.appery.io/documentation/b...

Graeme6630509
Posts: 0
Joined: Sun Feb 02, 2014 5:26 pm

Save array as multiple rows in collection

So I would need to add the call to the database to javascript? Is there any documentation on this?

Graeme6630509
Posts: 0
Joined: Sun Feb 02, 2014 5:26 pm

Save array as multiple rows in collection

Thanks,

I used code similar to the following to solve my issue:

var checked = new Array();

code
Appery("mobilecheckboxgroup_12").find(":checked").each(function(){
checked .push($(this).val());
});

for(i=0; i<<code>&#46;length; i++){

Code: Select all

 myService&#46;execute({ 
     data :{ 
             "col_a" : 1, 
             "col_b" : checked , 
     } 

 }); 

}
/code

Return to “Issues”