Trying to store a dictionary in tinyDB, and it's not working

I'm making Conway's game of life, i have feature where i can press the back button to go to a debug screen (with a console), i need the playfield to keep the same between those two screens. The log screen is Screen1, which just creates the tags for the message list, the cell array, then opens the main game screen.
The main game screen i'm storing the play field as a dictionary (cell_array), with each cell being a dictionary inside that, containing all the information for the cell.
When i try storing the global variable cell_array in it's tinyDB it doesn't seem to be doing it, because when i try retrieving that data, it doesn't find the tag (apparently)

this is the code for closing the screen

this is the code for initializing the screen

this is the code which gives me an error, when the first addition operation is reached, it says "The operation cannot accept the arguments: ,["not found x_pos", [30]

i've been working on this for like a week and for the last 3 days i've been trying to solve this glitch. This is for a school project, can someone help me?

The 'not_found' is poisoning attempts to treat the TinyDB return value as a dictionary on the first and subsequent runs of the app.

A better default would be the Create Empty Dictionary' block.

what do you mean poisoning the attempts?

Try this instead

Dictionary blocks only work with dictionaries.

P.S. You are doing the same thing with tag cell_array.

but that still means it's not finding the tag, which it should be, because i defined it in the last screen

also i just tried instead of "not found" if tag is not there, putting create empty dictionary and it still gives the same error

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

export_and_upload_aia

.

k_g_o_c_g_o_l.aia (12.2 KB)

here's the project

Can you grab a screen shot of that error?

The operation is not mentioned.

i'm using gennymotion emulator, but the same happens on my moto g54 phone. This happens after i press the back button to go back to the main game screen.

Global cell_array looks okay

but I am not getting much of a response from hitting the back key on my BlueStacks emulator in the Companion.

Your use of a loop over all cells may be very slow.

I am not getting that message.

All I get hitting Back is a clear grid, with a cell painted wherever the cursor happens to be when the redraw happens.

Try clearing TinyDB.

did you change the code in any way?

No.

But my emulator is different from yours, so screen sizes may differ.

Here's some bulletproofing for you:

P.S. Gotta run.
Maybe the night shift can pick this up?

ok good luck, i still need to fix the problem

by the way that just pushes the problem somewhere else, and i think its better to have the error message so i know what is wrong

You cannot add a string to a number.

If your output is generating the not found x_pos response, then you need to handle this before trying to draw your shape. Perhaps Try again ?

i know but the string is the value that tinyDB gives if the tag is not found, but i don't know why it's not finding the tag, i uploaded the project file a few posts above, you can check out what's happening there

In Screen Initialize you like to get the value


You only should change the not found by a create empty dictionary block

To store an empty dictionary instead does not make much sense

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


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

it doesnt solve it, it still means its not finding the tag, and it should be finding the tag because i initialized it in screen 1

i dont want to just make the error go away (which it doesnt because the guy before gave the same tip and the result was the same) what i want is for me to be able to leave the game screen, come back, and have it be the same it was when i left