Can't fetch additional info on scoreboardService

0 votes

Hello,

We are trying to send some additional info with user score like below:

App42API.SetDbName(CloudLoginManager.Instance.DB_NAME); scoreBoardService.AddJSONObject(CloudLoginManager.Instance.ADDITIONAL_COLLECTION_NAME,CloudLoginManager.Instance.JsonDoc);

scoreBoardService.SaveUserScore(TROPHY_LEADERBOARD_NAME, CloudLoginManager.Instance.UserName,trophyCount,new SaveUserTrophyCallBack());

But when we try to fetch the data, GetJSonDataList() method returns zero length.

Public void GetTrophyTopNRankings(){scoreBoardService.GetTopNRankings(TROPHY_LEADERBOARD_NAME,200,new GetTrophyTopNRankingsCallBack());}

Here is the callback method:

public void OnSuccess(object response){

Game game=(Game)response;

CloudLeaderboardManager.Instance.TrophyTopNRankingList=game.GetScoreList();

Debug.Log(game.GetScoreList()[0].GetJsonDocList().Count);

}

Thanks for your help,

Emre

asked Feb 15, 2015 in App42 Cloud API-BaaS by weare (10 points)

1 Answer

0 votes

Hello Weare,

 
To fetch the additional information of user along with leaderboard call, you have to set the query in leaderboard service instance before calling Top N Ranker method. Kindly have a look at this link for the code snippet & let me know if it helps.
 
Thanks,
Himanshu Sharma

 

answered Feb 16, 2015 by hs00105 (2,005 points)
Hello Himanshu,

I updated the code as you said like:

        string queryKey = "tempVal";
        string queryVal = "false";

        Query query = QueryBuilder.Build(queryKey, queryVal, Operator.EQUALS);
        App42API.SetDbName(CloudLoginManager.Instance.DB_NAME);  
        scoreBoardService.SetQuery(CloudLoginManager.Instance.ADDITIONAL_COLLECTION_NAME, query);   

        scoreBoardService.GetTopNRankers(TROPHY_LEADERBOARD_NAME, 200, new GetTrophyTopNRankingsCallBack());

But even there is no json file with tempVal = false, result is not empty. I guess the query doesn't work as it supposed to.

Am I missing something?

Thanks,
Emre
Hello Weare,

Could you please pass the query as null as shown in the below code snippet and check are you able to fetch the document or not.

scoreBoardService.SetQuery(CloudLoginManager.Instance.ADDITIONAL_COLLECTION_NAME, null);

Thanks,
Himanshu Sharma
Hello again,

I tried what you said with:

scoreBoardService.SetQuery(CloudLoginManager.Instance.ADDITIONAL_COLLECTION_NAME, null);

scoreBoardService.GetTopNRankers(TROPHY_LEADERBOARD_NAME, 1, new GetUserTrophyScoreCallBack());

and in CallBack I logged the result as follows:

Game game = (Game)response;
Debug.Log("get trophy score username: " + game.GetScoreList()[0].userName);

it still returns a result.

Thanks
Could you please share your some details regarding your app like appname, database name, collection name & game name for which you are finding the records. It will help us to provide better support to you.

Thanks,
Himanshu Sharma
I just sent a mail to support@shephertz.com including info. Thanks
Hello Weare,

Thanks for sharing the information with us.
 
We have checked from the backend and its working fine from our end. The reason why you are not able to find the records in the query is, 'tempVal' key has a value 'true' and you are finding with value 'false'. Please make the changes in query and search with ‘true’ value and it should work.

Thanks,
Himanshu Sharma
Hello,

The problem is, I also get result when I send a query with "tempVal" has a value of "false" even there is no record satisfying the query.
Hello Weare,
 
We cannot replicate it using your app. Could you please share method internal logs & result screenshots with us? It will help us to replicate the same at our end.
 
To print the method logs, put the below line of code before making a request of Leaderboard:
 
App42Log.SetDebug(true);
 
Thanks,
Himanshu Sharma
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 support@shephertz.com
...