TinyDB error on second screen

I have two screens. One of them is an output screen where there is a list view. The other one is an input where you can add values onto the list. The problem occurs when I input a variable onto the input screen 2 and when I return to the output screen 1, the variable is not in the list.
The code for screen 1 is:

Initialize global orders to create empty list
When screen1.initialize do **
set global orders to call TinyDB1.Getvalue **
** tag - "ordertasks"

** ValueIfTagNotThere - create empty list

set ListView1.Elements to - get global orders

Multiple screens are rarely worth the trouble.
If you use stacked Arrangements, only one Visible at a time,
you can access your ListView directly.

you might want to follow tip 1 here

Taifun


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

Hello parabellum

It should work, can we see your Blocks from both Screens? Right-mouse click in the Blocks work area and select “Save Blocks as Image”.

It might actually be the way you are saving/formatting the data…

The code looks like this:
blocks (2)

The tag from odd_order screen was Ordertasks

What about the other Screen “add_order”, which I assume is the populating TinyDb? Need to see how TinyDb is populated and how Screen “add_order” is Closed/Screen1 returned to.

Here’s for the add_order screenblocks2

Your problem is at the bottom of the Button1.Click Block. You are opening another Screen1 - you already have one in the device memory. So change that to a “Close Screen” Block and App Inventor will return the User to the existing Screen1.

Note, ensure that both Screens are using exactly the same Name Tag in TinyDB

on both screens you first have to get the data from TinyDB…
you could avoid all that hassle if you used only one screen as already mentioned earlier…
Taifun


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