Having trouble getting quiz app to count the score

Hello everyone,

I have been helping my 14 year old son create a quiz app as a school project. We watched the youtube video on the quiz blocks dozens of times and have figured out most of the basic functions in Thunkable X. What we are having problems figuring out is the APP Score. We cant seen to get it to keep track of the score. It will show 0/7 but will not count correct answers. I have attached a pic of our blocks and app screen and would appreciate any and all assistance.

1 Like

Welcome to Thunkable.

The blocks are too small to read. Appreciate if you can share the link to your project so someone can review and hopefully advise how to solve the issue.

This is a great starting project! Although not a terribly easy one. :wink:

Your blocks look correct to me but I can’t really tell without seeing the database values. As @muneer suggested, it’s best to share the project link if you’re able.

1 Like

I hope this link works. Let me know if it doesn’t. Thanks in advance for taking the time to assist.

https://x.thunkable.com/projects/6144d857f250e800115b62d0/d079d8ae-a279-4d79-a700-c1c5dd117813/blocks

1 Like

Do it this way

image

Set the change of Score as the first block in the function. These blocks work asynchronously and therefore the after answer function will run and will not wait for the correct answer function to finish.

Thanks for the quick advice. I have tried it as you suggested and I still get no change on the score. I have even deleted the variable, recreated and tried in the incorrect answer function all with no success. Banging my had on the desk but still enjoying ever minute working with my son.

1 Like

The tricky thing is that Thunkable hides the local data when sharing the project so this is all I can see:

Without knowing what your actual data looks like, it’s hard to troubleshoot your blocks.

You can try adding a Vibrate block (from the Devices drawer) to one or more places in your code to determine if the code is firing or not when you test the project on a device. Or in a browser, you can make a change to a label’s value to also determine this.

1 Like

Actually, I tend to think the data is stored in Google sheets. This is why we do not get to see the data and it makes it way hard to debug.

You are correct in saying it is stored in google sheets. Is there a better file type that might make it easier.

Tonight I tried and created my own local db table and entered my data but still I can’t get it to count correct answers. I can move it around to different functions and it works with some but not all. I am greatly in need of assistance.

Thunkable

Capture

I find this setup to be really confusing:

I don’t understand why you’re comparing the number 1 to a database value. Shouldn’t you compare the value of A’s button text to that database value? And only to the “answer column” value… which by the way should be the actual answer, not the index/position of the answer. And then the column names are integers which adds to the confusion, at least for me! Let me see if I can craft a simpler way to do this…

Here’s what I’d do instead:

Modified project link

2 Likes

The conditions are not just confusing but unachievable. See this example for first question
image

I added a Yes/No message to make it easier for me. The correct answer for Q1 is button A, but the condition can never be valid because the saved value under column 1 is actually 2 but the condition is expecting 1 so the score variable will never increment resulting on displaying 0 at the results screen.

1 Like

I am still trying to wrap my head around what you did but it’s amazing. I have only been using Thunkable for around 2 weeks and have learned a lot but what you did is going to take some time to sink in. I can not thank everyone in the community enough for their help.

I have a side question to ask and I can post a separate question if you would like so everyone can see. My local DB will eventually have around 100 questions. If I wanted to say do a short quiz of 15 or 20 random questions. Would that be done by modifying the “initialize app variable question” block. I see the "random integer from 1 to 100 " block but not sure how to limit it to say 15 questions.

3 Likes

This will get (and display, for testing purposes) 15 random row numbers from the local database. You can then use the generated list to select questions from the original database.

If you use the get and remove list block each time you pick a row number, you will only select unique rows and won’t repeat any.

2 Likes