How can I make a Dictionary Key carry over to a different page (via TinyDB)?

Hello all! I'm currently working on an assignment that requires me to make an app that has a log-in system, using TinyDB to store the user information. I need to make 4 pages, two of which are related to the log in. One page is the log-in page, and the other is a "user registration" page where one can make a brand new account.
I've completed most of it, however I cannot figure out how to make the "new user information" pass from one page to another. As you can see in the included code, I have used 1 page with two different "page views", which alternate between visible and non-visible, in order to simulate two pages. But I'm worried that it might not meet the assignment criteria, which states that I must have two separate pages for [login] and [registration].

Here's the code for the page, which must be separated into 2 pages:

How can I separate this into two pages whilst keeping the functionality the same?

Thank you!

in design view, select screen2 layout, press ctrl +C, add a new screen, press Ctrl V, the components and the code will be copied.

Funnily enough, that's the exact opposite of what happened - I first made two pages and attempted to do what I described above. But for some reason the dictionary won't carry over the information between the pages, so although I can make a new account in page 2 (registration), I cannot use that info in page 1 (log in).

What you're seeing is a result of me taking the blocks from page 2 and pasting them into page 1, effectively merging page 1 and 2. Separating them by force will not make the code work, at least not like this!

If real Screens fail, why not use virtual screens as shown here Building Apps with Many Screens ?

Many App Inventor developers do this to avoid situations you are experiencing. Use virtual screens and you do not need to 'carry over to a different page' ; just show and hide layouts. :slight_smile:

Thanks for the advice! However, isn't that what I came up with up there? Adding a "virtual" screen that can be shown and hidden based on the situation.

The code works as-is very well, but I'm just worried that not using multiple "real" screens would go against the guidelines set in the assignment.

A screen change is a screen change. Is this against the guidelines? Ask your teacher. If he/she understands programming the instructor should allow it. :cry: But you will never know unless you ask or submit your Project using a virtual screen and wait anxiously for a grade. Virtual screens 'change' screens and have none of the draw backs of a Screen.

1 Like

I agree, it's so much simpler to use a virtual screen....

I would still like to figure out how to use two separate pages to accomplish said task, but I think that it might require a completely different set of blocks.

Thank you very much for the help, though! :grinning_face_with_smiling_eyes:

You would have to pass the whole dictionary to the other Screen, which you should be able to do under one tab in TinyDb.

If I were you, I'd submit both solutions, the efficient Virtual Screens Project and the inefficient two Screens Project :thinking: