TinyDb Help on multiscreen quiz scores

I realize this is an old topic, but I'm running into the same issue. Here is the project: MIT App Inventor Gallery
I'm trying to store the score on a quiz and retrieve it on a new page. Any help would be appreciated.

Your TinyDB Namespaces are probably crossed:
(Middle school)
image

Scores:

image

image

WHen using multiple TinyDB components and Namespaces, it is helpful to rename their components (tdbScore) in addition to changing their namespaces, to keep their purpose clear.

For convenience, here is your Project Export, uncorrected:
Digital_citizenship_quiz.aia (68.7 KB)

Thanks, I think that fixed it! The Score page is correctly recalling the score and using that value to determine the user's final grade. For some reason the web interface is still giving me the runtime error message invalid application. Irritants: (#!null) but the app companion is working correctly. At this point I can probably move forward with it (I'm completing this for a class project). Thanks again for your help!

Does this happen on Android?

Sorry, I had to borrow an Android device to test this.

It's not giving the Irritants error on Android. It does give an error when the question number exceeds the number of questions, which it doesn't do on iOS. I understand the logic on that one but I'm not sure why it only gives that error on Android.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

Digital_citizenship_quiz.aia (93.9 KB)

Here is the .aia file. I was using a simple code for advancing the questions. I just created a variable that added one to the question number (initialized as 1) when the Next button is clicked. Once the question number exceeds the number of questions in the list, it advances to the Score page.


Notice how the Next button calls GetQuestion even after procedure QuestionNumber has returned, regardless of whether or not QuestionNumber has opened another Screen.


The Score screen refers to TinyDb for its score, so this startValue is superfluous.


Your GetQuestion procedure does not check if the global QuestionNumber is still in range.
It also has a meaningless self-assignment of a variable to itself.

This is safer:

On the whole, making separate screens for seperate quizes is a mistake.
The questions and answers should be loaed from a File or spreadsheet somewhere.

Thank you so much! This is all really helpful. Like I said, this app was just an exercise to introduce us to the concept of block coding in a Library and Information Science class, so this was my first attempt at doing anything like this. I'll be sure to try redoing this with your suggestions. I really appreciate your willingness to help!

Replying to myself, but I changed the Question Number procedure to this:

Then updated the Next button is clicked control to this:

It now goes through the entire app with no error messages.

Edit: I tested on iOS and Android, good on both.

1 Like