Asif Ansari
Posts: 0
Joined: Tue Jul 07, 2015 4:00 am

Adding checkbox values to an array data type

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.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Adding checkbox values to an array data type

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

Return to “Issues”