We got a problem with data sources. We created an app for education purposes yet its having problems on the quiz screen. We create a local database for the Questions, Answers on the buttons, correct answer, animations and messages after the user done answering. The problem is it seems that the app is not reading the data set on the local database. Even if correct answers were set on the right column and blocks are arranged correctly, it would still stay that the answer is incorrect. We set 40 questions on the database and maybe less than 10 are working and achieved what we want to do and how it should work. We hope that you can help us out on this. Attached are screenshots of the blocks, Database and when the applications problem.
Your mistake is that you are using math blocks to compare integer values (1, 2, 3 and 4) with the answer choice values in columns “1” and “2” and “3” and “4”. When you click on Button1, for example, your
if block checks to see if 1 is equal to the answer in column “1”:
So for example, for question #29, you’d be comparing 1 and -16 to see if they are equal. That makes no sense and will almost never be true:
That’s not what you want to be comparing. You want to compare the value in column “Check” to the value in column “1”.
Honestly, one way to avoid these mistakes is to not give your columns integer names. “1” is not a good pick for a column name. I would recommend something like “Answer #1” or “Answer Choice #1” instead.
Thank you for the response. I just have a question if I will continue using Math blocks or what do you suggest to use. I already change the database label to Answer #1 etc.
You have four answer choice columns and one answer check column. Compare the choice that is clicked with the Check value.
So you will then have:
When button1 clicked:
if get value in Check = get value in Answer #1 then → correct answer
When button2 clicked:
if get value in Check = get value in Answer #2 then → correct answer
When button3 clicked:
if get value in Check = get value in Answer #3 then → correct answer
When button4 clicked:
if get value in Check = get value in Answer #4 then → correct answer
A math block is just a math block. It’s just a numeric value. So the math block
1 only stands for the number one. It doesn’t stand for anything else. It’s like if I said to you “What is four times six?” and you answered “24” but I told you “Sorry, that’s wrong. The answer is 1.” And then next question: “What is three plus five?” and you answered “8” but I told you “Sorry, that’s wrong. The answer is 1.” The way you have it coded, every time you’re comparing 1 with the user’s answer choice.
If you still can’t get it to work, post a screenshot of your
when Button1 Click blocks.
Thank you very much for the help. It is now working.
You have been a great help.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.