Page 1 of 1

Service Where Clause

Posted: Thu Mar 13, 2014 6:57 pm
by Malcolm van Raalte

According to:

http://docs.appery.io/documentation/b...

I can add a constraint to my list service. I have two collections:

Organizations
Initiatives

where Initiatives has a Pointer column to Organizations. The column is called "organization".

I've created a List service for Initiatives. I've manually added a "where" parameter to the Request parameters. When I specify a default value of:

{"organization" : {"name" : "test"}}

it correctly filters the list to only those Initiatives that belong to the "test" organization. However, when I go to Test and enter the same where string there it returns no results.

What could be causing the issue?


Service Where Clause

Posted: Thu Mar 13, 2014 8:25 pm
by Nikita

Hello,

You should use a query like this:
http://docs.appery.io/documentation/b...


Service Where Clause

Posted: Thu Mar 13, 2014 8:33 pm
by Malcolm van Raalte

Isn't that what I've done with: {"organization" : {"name" : "test"}}

?


Service Where Clause

Posted: Thu Mar 13, 2014 9:38 pm
by Nikita

Not. You are using the wrong type query:

{"subtask": {"collName":"todo", "_id":"5278ef66e4b01085e4b79482"}}

subtask - column name with type point,
todo - column name on which pointer refers,
"_id":"5278ef66e4b01085e4b79482" - corresponding filter.

So you should use query like this:
{"organization": {"collName":"Initiatives ", {"name" : "test"}}


Service Where Clause

Posted: Thu Mar 13, 2014 9:47 pm
by Malcolm van Raalte

Ah.

Just tried:
{ "organization.name" : "test" }
and that worked too.


Service Where Clause

Posted: Thu Mar 13, 2014 10:09 pm
by Alena Prykhodko

Malcolm, have you managed with this?


Service Where Clause

Posted: Thu Mar 13, 2014 11:05 pm
by Malcolm van Raalte

Yes, the "dot notation" is working.