ScoresByUser with additional data

0 votes
Hello,

I'm using the Javascript SDK and was wondering...

If I SaveUserScore with additional data why can't I get ScoresByUser with additional data
asked Nov 15, 2014 in App42 Cloud API-BaaS by Kenny Arneaud (15 points)

1 Answer

0 votes

Hello Kenny,

You can get the additional along with getScoreByUser method as well. Kindly find the below code snippet & let us know if it helps:

 

var gameName = "<Enter_your_game_name>",

userName = "Nick",

result ;  

App42.setDbName("Your data base name");

var build = queryBuilder.build("Key", "Value", Operator.EQUALS);         

scoreBoardService.setQuery(collectionName, build);

scoreBoardService.getScoresByUser(gameName,userName,{  

            success: function(object) 

            { 

                        var game = JSON.parse(object);  

                        result = game.app42.response.games.game;

                        console.log("gameName is : " + result.name)

                        var scoreList = result.scores.score;

                        console.log("userName is : " + scoreList.userName)

                        console.log("scoreId is : " + scoreList.scoreId)

                        console.log("value is : " + scoreList.value)

            },  

            error: function(error) {  

            }  

}); 

 

Thanks,

Himanshu Sharma

 
answered Nov 16, 2014 by hs00105 (2,005 points)
Ok so are you saying that for the most part I can create custom querys to go with almost all service endpoints? Like say I want to collect data from a collection and also related data from another collection? I can using this QueryBuilder? class? Is there any documentation on this class that I can peruse?
Kindly have a look at the below link to integrate the query builder class & let us know if it helps:
http://api.shephertz.com/tutorial/Querying-Your-App-Data/?index=query-appdata

Thanks,
Himanshu Sharma
No...no it doesn't.
HI Kenny,
Additional data storage uses Storage service internally and when you fetch it, it goes internally to storage service again. We have this functionality in getTopNRankers and other get methods(except GetAverageScore) in scoreboard service which internally depends on storage service to fetch additional info . Also, you can fetch these additional info directly from storage service using that above link.
This is good...but i have been trying to do this using the addQuery  object and get a lot of #1401 #401 error codes.
Could you please share the code snippet with us which you are using? It will give a better insight of the issue.
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
...