My app crashes in any preview mode from these blocks, why?
What blocks am I using wrong? Thanks.
The only thing I notice is that you’re using text strings as integers (random integer from…).
That may work but if not, then you need to convert the strings by adding zero to each one (set stored Qstart to (get value from levels … + 0). I doubt that would actually crash your preview, though.
My other guess is that the row id value doesn’t match between the data viewer and the data source (levels).
If it is crashing on start up, the stored variables may not have any values. Referencing a variable without a value causes Thunkable to crash (guess how I know that…).
You might try checking for null when setting the label values, something like this:
Thanks, drted! Your advice is tremendous!
@drted Here is the troubleshooting, which you might be able to explain why it’s crashing, see below.
Just Navigate = No crash
Just Set var, get var = No crash
Set var, get var & Navigate = Crash
I do initialize all the variables or set them on the first screen, see last image.
Great details, thanks!
Here are a few more thoughts:
1.Have you tried adding a WAIT block between Get Value and Navigate to? I’ve found when getting data from external sources, WAIT blocks can make a big difference (I hate it, but it is true). I will typically start with a short wait (1 second) and then a LONG wait(10 seconds), just to see if Thunkable is struggling.
2. What happens if you set just Qend and navigate? Just QStart and navigate?
3. Does quiz 01 start or open events read or write to either QStart or QEnd?
Those are my thought, but I don’t have any silver bullets…
@drted Thanks again WAIT helps me see the vars code is working except in the scenario below.
I have pin pointed what circumstances are required for it crash.
It is when the following takes place (other scenarios it will work fine as mentioned in previous posts)
Including 2 get localdb blocks (1 will not crash)
Navigate to the Quiz screen (won’t crash with 2 localdb & navigating to any other screen)
So the question is why would 2 get localdb and navigating to the quiz screen result in a crash?
For more color on what I’m doing on the quiz screen here are some screenshots of those blocks.
I’ve had repetitive external data pulls cause errors. What happens if you put a long wait (10 seconds) between the Get Value blocks?
Responses to your specific questions:
That about all the things I can think of. I gave up on real-time use of datasources because of issues like this.
What I do now is copy my data sources (google sheets) into Firebase and use Firebase to populate my app. Data Source Performance Workaround FOUND!
Good luck and Happy Thunking!
Just gonna link to this here
Have you confirmed that the row IDs are the same for the data viewer list item and the local data source?
@drted Thank you for the recommendation. I was playing around with Firebase I just couldn’t figure out how to use it in thunkable. I will read your link and if I can learn it, then I’ll use Firebase.
@tatiang I know what a row ID is but choose to not use it because it was some long random number. Instead I made columns in the data viewer database that dictates what problems to load for the quiz. That is what Qstart and Qend vars are.