Cricket Score Results

Are the results real-time? because I ain’t getting anything solid. Or is there any error in the code:
var unique_id
for (var i=0; i<match_list.length; i++)
{
if(match_list[i][“team-1”] == team || match_list[i][“team-2”] == team)
{
unique_id = match_list[i].unique_id
break
}
}
Screenshot 2020-09-19 133611

Hi Siddharth,

The results aren’t real-time. The data returned to Voiceflow depends on CricAPI. If it does not have an entry present for the team you selected, then, in that case, you may not see any values returned by the API.

I used the same code you posted here and was able to get results for Delhi Capitals. Here’s the screenshot for the same:

Also, here’s the updated code which has been provided as the text section in the lesson. This code handles the uppercase and lowercase of the team uttered. That is, this code will be able to Identify Delhi Capitals as well as delhi capitals:

var unique_id
team = team.toLowerCase()

for(var i=0; i<match_list.length; i++) {
team1 = match_list[i][“team-1”].toLowerCase()
team2 = match_list[i][“team-2”].toLowerCase()

if (team1 == team || team2 == team) {
unique_id = match_list[i].unique_id
break
}
}

Let me know if this works for you and answers your question.

I did got the results for yesterday’s (Delhi vs Punjab) match but when I tried for (Chennai vs Mumbai) day before yesterday I got null results. My only doubt is does the API stores only temporary scores or random scores?

The results are not Live scores, but of the matches that happened recently and the ones that are going to happen in a few days. In cases where the match is about to happen in few days, the result will be black(or 0). They depend on the API, the name you utter has to match the one that has been listed in the API.