How do I store Score points through different screens (quizz app)?

Hi everyone!

I was wondering how to implement a store storage throughout my quiz screens.

In my quiz app which has 5 screens (1 screen: start screen, screen 2-4 quiz screens, on every screen is a question dislplayed)
I also integrated the tinyDB of App inventor in every screen.

I basically want the user to do the quiz and every earned point to be stored in the next screen and increased if the answer is right. How do I do it, do I have to initialise every value on every screen? I thought it would be a solution if the user clicks on 'get pounds' in order to store the points earned?

I tried and for the first question, it works. But it doesn't store and add the points if I solve the next quiz. I know that I should use "virtual screens", but still want to open a new one for every question.

Thanks for your help!!


Ajoutez un à la valeur de tiny DB à chaque bonne réponse sur chaque écran avec le même tag.

Nico

1 Like

Thank you!
Is this right?
blockview_tinydb

And should I still initialise the score then like this or how else?
blocksview

thanks in advance!

1 Like

There is a Screen.Initialize event where you can load global variables and display components from TinyDB.

You can simplify scorekeeping by leaving out the global variable and by referring directly to the TinyDB GetValue of the Score tag.

It is important to use 0 as the default TinyDB value if not there, instead of blank text, to avoid poisoning the '+ 1' operation with text blank later on.

1 Like

Do not use screens. Use "virtual" screens (arrangements). Switching them on and off.

Remplacez la variable Score par le bloc de Tiny DB ''Obtenir la valeur'' du tag ''score''

Nico

Hi, I'm just a beginner but kind of had the same problem with a quiz app and the TinyDB storage worked for me.

Also added 1 label to say 'Score' and another one to display the score next to it.

That's on Q1:

image

and then next screens:

image