Colten Tenney
Posts: 0
Joined: Thu Sep 25, 2014 3:41 am

Server code query

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Server code query

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

Colten Tenney
Posts: 0
Joined: Thu Sep 25, 2014 3:41 am

Server code query

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Server code query

Awesome !!! Nice job...

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Server code query

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...

Return to “Issues”