My TinyDB is not working

My TinyDB was working yesterday when I ran it. But now my TinyDB doesn't store data anymore, can someone help me? Here is the app ProductApp.aia (1.7 MB)

Your problem is on the Checkout screen, you cannot initialise variables directly from the tinydb (see you have red crosses there), you need to set them in the Initialise event.

image

If you fix this, does it work now ?

where should i set them?

That's good Edmar. Oh, I see you have withdrawn your post "It works now". Never do that, it makes your Topic impossible to follow by others who may be in a position to help.

I noticed that you use "open another screen" to return to Screen1. That is literally opening another instance of Screen1 every time - until the memory gets filled and the App crashes. Simply use close screen instead.

Concerning TinyDb - you are trying to use GetTags for the wrong purpose. I do not understand your logic so I cannot offer a correction - why have you got two TinyDbs pointing at the same namespace? Or, simply, why two TinyDBs? You have four different Totals, all displayed by the same Label (Label4) - how is the User going to know which total they are looking at? Perhaps it would be better to have a label for each?

Lots to sort out there :grin:

Instead of repeating commands in two different Buttons, put the common commands in a Procedure:

blocksClear

The 'Back' buttons on the other screens need to be corrected as per the Checkout Screen. Anywhere you have "open another screen" for Screen1 has to be fixed.

1 Like

...you could enhance your component naming so that everyone can understand which is what - or indeed you can if you open the project again 6 months later. See my site for tips:
https://www.professorcad.co.uk/appinventortips#TipsGui

1 Like

Yes, naming things properly is half the work in programming.
Example ...

2 Likes

Thankyou so much for the tips sir! The tinydb is working already, I think I have problem on my if else statement though ProductApp (5).aia (1.7 MB)

This is noted sir thankyou!

Yes you do :upside_down_face: If you have a sketch/drawing that you used to design your App, that would help us to understand too hopefully.

Is the App basically staying as-is? I ask because you are already using more screens than necessary and the limit is 10 screens. If the App is going to become huge, you might want to use Virtual Screens instead. Screen1 is the ‘real’ Screen and device-sized Vertical Arrangements on it are displayed/hidden as required - they are the Virtual screens.

You are definitely wasting screens on different pizza menu items.
You must learn to use lists, tables, and how to reuse images, Labels, and Textboxes across your product line.


See http://ai2.appinventor.mit.edu/reference/other/manyscreens.html
from
http://ai2.appinventor.mit.edu/reference/other/manyscreens.html