Label display stops working after 9 loop iterations

Background:
Hey folks, I’m creating my first app in Thunkable and making good progress. It’s a simple maths game to teach kids the Times Tables. At first I thought I needed 12 screens for every table (1x1, 1x2, 1x3…) but quickly realised that would be horrible. I’ve now (mostly) created a single screen which iterates through the 2x table (up to 12) using Local Tables for source information. Each row in the DB represents an equation. So far so good.

Problem:
As the player selects the correct value, the correct ‘equation’ is displayed to confirm their answer. I then increment the ‘current_level’ variable, and the elements are updated for the next question. This works correct for equations 1-9.

However upon equation 10, the displaying of the ‘equation’ just stops working. The rest of the elements update properly; the question itself, the distractors, however it’s just the ‘correct label’ isn’t displayed when you get the answer correct for equations 10,11 and 12.

Is anyone able to spot the logic error here? Thankyou so much in advance


code-2
local table

1 Like

Here is an example of the app working, and also when it stops working:

Answer for 1-9 works:

Answer for 10-12 doesn’t display:

3 Likes

Had to like your post because you provided such helpful information! :+1:

What comes to mind for me is a long-standing bug with the get value block. I don’t know if it has been fixed yet but if not, that block would return cached values from the data source instead of the current values.

What is the value of app variable current_level when it stops working? That is, if you display that variable in a label’s text when it should be 10, does it in fact display 10?

And what happens if you manually do a get value from row 10 without running through the rest of the code? For example, if you just assign a label’s text to that value when the screen opens?

I’m hoping to isolate the issue by knowing the answer to those questions.

3 Likes

Thanks Tatiang for the reply and good ideas for debugging!

Checking current_value:
I created a new label which displays the current_level. The value correctly displays at each level, both when it’s working and when it stops working. So for now I think we can rule that out.


Just doing some more testing on the get_value block - will revert back soon

2 Likes

Checking Get_value:
I added a hard-coded block to check that answer_label from row 10 could be called successfully from the database (since this is where the error starts), and it looks like it can, with “2 x 10 = 20” being displayed:
get_value_check2

I then added a block just above where I think it goes wrong, to display the current equation, and that’s working for every level.

In the end, I just created a new label and added new logic to that one, and watched them side by side. The new label was working correctly, whilst the old label continued to break from 10+. I don’t know what I did to ‘bug’ out that label, but I ended up deleting it altogether. Oh well! For now I’ll consider this issue closed - thanks! :slight_smile:

3 Likes

How strange but… good detective work!

1 Like