NO SQL Storage - how to use multiple operator Query search

0 votes

NO SQL Storage.

I was trying to create a query with multipel conditions like 

NAME = "SAM"   AND (AGE = 15 OR AGE = 16 OR AGE = 25)

How can I do this to retrieve from the cloud and how to continue with below :

Query q1 = QueryBuilder.build("NAME", "SAM", Operator.EQUALS); 
    Query q2 = QueryBuilder.build("AGE", 15, Operator.EQUALS);
    Query query = QueryBuilder.compoundOperator(q1, Operator.AND, q2);  
 
hwo how to add the remaining Ages too into the same query ? 
   
asked Sep 1, 2015 in App42 Cloud API-BaaS by jingahr (31 points)

1 Answer

+1 vote

Hello,

 

Please find a below code snippet to make a query on multiple values and let me know if it helps:

Query q1 = QueryBuilder.build("Age", 15, Operator.EQUALS);
Query q2 = QueryBuilder.build("Age", 16, Operator.EQUALS);
Query q3 = QueryBuilder.build("Age", 25, Operator.EQUALS);
Query q4 = QueryBuilder.build("Name", "Sam", Operator.EQUALS);
Query query = QueryBuilder.compoundOperator(q1, Operator.OR, q2);
query = QueryBuilder.compoundOperator(q3, Operator.OR, query);
query = QueryBuilder.compoundOperator(q4, Operator.AND, query);
 
Regards,
Himanshu Sharma
answered Sep 1, 2015 by hs00105 (2,005 points)
Thanks , This helps ..
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
...