Page 1 of 1

Server code query

Posted: Mon Mar 02, 2015 1:54 am
by Colten Tenney

I'm not sure how to 'or' criteria when adding parameters to a query within servercode. I have attached a snippet. Is it correct? I get no errors, and an empty array when there should be data. Image


Server code query

Posted: Mon Mar 02, 2015 5:28 am
by Bruce Stuart

Colten - notably - the criteria you have created is a JSON object I believe - however - the criteria parameter that gets appended to the params ---- needs to be a string - so - you can either:

JSON.strigify your statement above or you can form a string query - much like the one I pulled from some working server code that I have moments ago...

var stimein15 = ThedateresultsofsomefunctioncallStringType();
var sQuery = "{'dutcsendnotification': {$lte : '" + stimein15 + "'}, 'snotificationstatus' : 'U' , 'sstatus' : 'U' }"
//console.log('Query for use against db for Notifications to be sent:' + sQuery);
params.criteria = sQuery;

hope that helps,

Bruce


Server code query

Posted: Mon Mar 02, 2015 7:31 pm
by Colten Tenney

Thank you very much Bruce. I reformatted my quotes similar to yours. Here is the code that works.
Image


Server code query

Posted: Mon Mar 02, 2015 7:51 pm
by Bruce Stuart

Awesome !!! Nice job...


Server code query

Posted: Mon Mar 02, 2015 7:53 pm
by Bruce Stuart

Oh... And we should thank Yurii as well.... He taught me what little I know about server code through a couple of examples he provided ... So I'm just passing on what was thankfully passed on to me...