Sign In Register

How can we help you today?

Start a new topic

check getParticipantData null or empty

Hi,

Im trying to retrieve participant data of matched players, some of them have participantData and some of them don't. I'm not able to find the way I can check if the player has participant data because an error is given on players with no participantData: "Error evaluating statement :- null" . Is there any way to check it?


Thank you very much.


Hi Jesus,
can you share your code as well so it will better clear.

Of course, firstly I take players details

var players = pendingMatch.getPlayersDetails();

 then I loop through the players to get participant data, but some of them doesn't actually have it, but I can't check that.

for (var i = 0; i < players.length; i++)
{
    if(players[i].getParticipantData() != null){
        [...]
    }
}

 Thank you very much for the quick answer.

for (var i = 0; i < players.length; i++) { if(players[i].getParticipantData() == null){ i++; } else{ [...] } }

Hi,

the error keeps on. If it's usefull I create the match with  

Spark.getConfig().getMatchConfig(matchCode).createPendingMatchWithCustomQuery([...]);

 If I could set participant data here all problems will be solved, but I didn't find any way to get access and set it from here.

Login to post a comment