You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I successfully followed the Android SDK documentation and managed to connect a ListView to a loopback API. Actually I can show all elements of one rest ressource in a list now.
As the amount of elements will increase and only current "bet" objects will be relevant I need to filter the bets on the server rather than doing this on the client after fetching all of them.
Oh, this is an unintended omission. The class ModelRepository should implement a find method that would accept the filter object (a hash map) as an argument.
The hash-map based version is a minimum implementation. A better solution is to provide a criteria builder similar to what is described in #74 (comment).
I am afraid this issue is not a high priority for us at the moment. However, if there is any volunteer willing to contribute this feature, then I am more than happy to help him along the way.
Activity
[-]'Find Where' in ModelRepository Model.[/-][+]'Find Where' in ModelRepository[/+]philippdhh commentedon May 26, 2015
Hello,
I think I am struggling with the same problem.
I successfully followed the Android SDK documentation and managed to connect a ListView to a loopback API. Actually I can show all elements of one rest ressource in a list now.
The Android SDK calls the API provided by loopback framework with the URL http://api.wdapp.de/api/bets
This delivers all "bets" to the client.
As the amount of elements will increase and only current "bet" objects will be relevant I need to filter the bets on the server rather than doing this on the client after fetching all of them.
Loopback offers the filters for this. I would like to call:
http://api.wdapp.de/api/bets?filter[where][dueDate][gte]=2015-05-27&filter[order]=dueDate%20ASC
for example to only show current objects in my prefered order.
Actually I hoped to find a findByWhere or findByCriteria method in the API to solve this problem.
When I think about using a Doctrine ORM Repository (PHP) there is a solution like this:
Is there any best practice to solve this problem using Loopback Android SDK?
Thank you in advance,
Philipp
bajtos commentedon Jun 2, 2015
Oh, this is an unintended omission. The class
ModelRepositoryshould implement afindmethod that would accept the filter object (a hash map) as an argument.bajtos commentedon Jun 2, 2015
The hash-map based version is a minimum implementation. A better solution is to provide a criteria builder similar to what is described in #74 (comment).
I am afraid this issue is not a high priority for us at the moment. However, if there is any volunteer willing to contribute this feature, then I am more than happy to help him along the way.
serjooo commentedon Apr 9, 2017
For anyone trying to make where work you only have to do the following:
Also remember in my example I have used JsonObjectParser for returning a signle object. If they were multiple objects use the JsonArrayParser