Android : Parse SDK in Android - group by alternatives

on Sunday, October 12, 2014


My parse DB has 4 models:



  1. User

  2. League

  3. Game

  4. GameEvent


User has many leagues. League has many games. Game has many gameEvents.


Table structure:


League enter image description here


Game enter image description here


GameEvent enter image description here


I managed to fetch all the GameEvents of a given league and filter them by:



  1. Type = 7 (type = goal)

  2. createdAt between the dates the user enters


However, this is not the data I need as I want to find how many goals every player scored in this league between the given dates. (player name is stored as a string in the title field of the GameEvent model). Basically, I need an SQL style "GROUP BY" query in order to get the count, but "GRUOP BY" is not supported by Parse.


I considered using Parse "cloud coding" with an after_save event, but it won't work because the createdAt range is dynamic.


Is there a way to do it without counting the results in the app itself?


0 comments:

Post a Comment