How to query using multiple AND operators

0 votes

Hi,

I have a following code snippet:

var key1 = "title", value1 = "title";
var key2 = "abc.param1", value2 = "xxx";
var key3 = "abc.param2", value3 = "yyy";  
var queryBuilder = new QueryBuilder();
var q1 = queryBuilder.build(key1, value1, Operator.EQUALS);      
var q2 = queryBuilder.build(key2, value2, Operator.EQUALS); 
var q3 = queryBuilder.build(key3, value3, Operator.EQUALS); 
var query = queryBuilder.compoundOperator(q1,Operator.AND,q2);
query = queryBuilder.compoundOperator(query,Operator.AND,q3);

 

with above code, somehow it ignores to match the title, and it only gives me results which have abc.param1 = ""xxx" and abc.param2="yyy"
 
Here, title is a simple string field in JSON and abc is JSON array of custom objects.
 
I am using Javascript. Please let me know what I am doing wrong.
asked Dec 14, 2015 in App42 Cloud API-BaaS by jitesh.h.lalwani (20 points)
Hello Jitesh,

Is it possible that you can share your sample JSON with us. It will help us to provide better support to you.
Regards,
Himanshu Sharma
View JSON
 {
  "releaseDetails": [
    {
      "releaseDate": "12/18/2015",
      "country": "IN"
    },
    {
      "releaseDate": "12/18/2015",
      "country": "US"
    },
    {
      "releaseDate": "12/18/2015",
      "country": "GB"
    }
  ],
  "title": "abc",
}

this is the JSON we are using:
We want to query something like "where title='abc' and releaseDetails.releaseDate ='12/18/2015' and releaseDetails.country='IN' "

but currently whatever title i put, if the release details match, its fetching that record. Please help us resolve this.

1 Answer

0 votes
Hello Jitesh,

 

It seems like there is an issue with the latest version of App42 JS SDK. We will resolve this issue by tomorrow, will share the latest binary with you.

Thanks for your patience.

Regards,

Himanshu sharma
answered Dec 14, 2015 by hs00105 (2,005 points)
Thanks for the update.
Hello Jitesh,

Please download latest binary of JS SDK from here (  http://cdn.shephertz.com/repository/files/9aadd81587bdcf5de6487bfb07d4f3b152fbf9000b899f8c71285eff700ce69e/f766c1cf01569a0fcf3183689e401cdf057ffb05/App42.js) and let us know if it helps.

regards,
Himanshu Sharma
Thanks Himanshu. This looks good.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...