Sum of score group by users in ScoreBoard

0 votes
I am using iOS sdk. I want to display total score for each user in order to display the top scorer users of the game. How can i achieve this?
asked Apr 17, 2014 in App42 Cloud API-BaaS by nilesh (109 points)

1 Answer

+1 vote
Best answer

To display top scores in your game you can simply use get_top_n_rankers. In Which you can also short your game scorer by adding custom header  for documentation get_top_n_rankers_by_sorting.

To get total scores of user you can use get_scores_by_user

If you want to get sum of user scores you can do this by using our storage service. In which you can simply insert your user score in JSON format and get the sum of score by using map_reduce function like this.

String result = storageService.mapReduce("<DB Name>","<Collection Name>","function map(){ emit(this.userName,this.score);}",
"function sum(userName, score){ return Array.sum(score)}}");
answered Apr 18, 2014 by sshukla480 (407 points)
selected May 21, 2014 by nilesh
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on