Need help local db


#1

https://x.thunkable.com/projectPage/5d04505bcce833594e38e63e

So on “screen2” when i press next “ButtonNext” i want my “questionLabel” and “ExplainLabel” to change text to the next row in my “Local_DB1”.
Can some1 please look at my code and say what im doing wrong
P.S im a newbi


#2

The problem seems to be with the incrementing of the QuestionNumber.

The screen starts by loading question #1 using Restarta DB because that is the initial and current value of QuesitonNumber.
So, the user clicks on the ButtonNext, and it does a currently empty If block, and ends up calling “aftertheuseranswer”.
And that is where there is an issue: if the current question was the last one (QuestionNumber is equal to the number of rows in the database), then the program is expected to return to the calling screen – which is appropriate – but it also increments the QuestionNumber as if it was readying for the next round. The second and 3rd statement in the If block (incrementing the index, and calling Restarta DB) need to be in an ‘else’ section of the If block.