Page 1 of 1

Adding checkbox values to an array data type

Posted: Mon Aug 17, 2015 9:42 pm
by Asif Ansari

Hi, I am able to insert an array into the collection. I just have 2 values that I am using, a 0 and a 1. The data looks like the following after it has been inserted into the collection: [["0","1"]]. I am now trying to do a query on this data in server code where if its a 0, then it should only return 0 value records, and if its a 1, then only 1s. But if it is 0 and 1, then I want any records that have either a 0 or a 1, or both. Here is the relevant code:

var param1 = requestParams["param1"];

var params = {};
params.criteria = { "param1" : param1 }

Code: Select all

 }; 

var res = Collection.query(dbId, "whatever", params);

param1 represents the array field and could have 1 of the possible 3 values:
[["0"]]
[["1"]]
[["0","1"]]

This code is not returning any records. I think I am either doing something wrong when inserting, or I need to convert the data some how when querying. How do I get it to return records? Any help on this is much appreciated.


Adding checkbox values to an array data type

Posted: Fri Aug 21, 2015 8:28 pm
by Serhii Kulibaba

Hello Asif,

You use incorrect parameters.
Please look this link with server code documentation: https://devcenter.appery.io/documenta...

Could you show us screenshots with real your parameters and database structure?
Also write us example data, which you want to get