Can you pass two databases from one screen to another?

  • Create a screen two bases of TinyBD1 and TinyBD2 data. Various data stored in each.
  • Create another screen TinyBD1 two databases and data TinyBD2. Tries to retrieve data from the two bases of the first screen. It's possible?
  • You can only spend the last database where we saved on the first screen?
  • Can you move, the way we have seen in this tutorial, several TinyDB?

If you done. please send me aia file? please please

First, you need to ask yourself: why do you need 2 TinyDBs?
You could use firebaseDB or cloudDB instead since you don't have to pass the values between the screens.

If you're adamant. however:
(Note that I will only be using different namespaces instead of two components since it saves memory):
image
image
Make sure to change the namespaces and tags to your defined ones. You can duplicate the code if more than 2 tags per namespace; however, you could use a for loop to diminish the amount of recurring code in your app.

2 Likes

TinyDB1 on Screen1 is the same as TinyDB1 on Screen2 because they have the same NameSpace = TinyDB1

TinyDB2 on Screen1 is the same as TinyDB2 on Screen2 because they have the same NameSpace = TinyDB2

2 Likes

Here is something about TiniDB and Namespace,

1 Like

Or just use one TinyDB1 and set different namespaces for different databases

image

(you have to set the namespace everytime you want to access the data therein)

2 Likes

This behaviour have analogy with mysql> USE DepartmentDB/AccountDB and do some operations to the selected db. Having different namespaces in on Tinydb is similar to maintaining/managing different databases.

But having different TinyDBs under one namespace will be referring to the same storage space only, just as aliases.

This does not read correctly. Different namespaces under the same TinyDB, are distinct, as is the data.

2 Likes

Thanks TIMAI2, after having more clarity about Tinydb, I have a concern, there need to be a way to show/delete namespaces, which are there in a specific TinyDB, or it's not much useful/greaful to listing all associated namespaces with one TinyDB.

Perversely, you could save your namespaces in a list, then store that list in a tinydb for recall :wink:
Working with multiple namespaces in one tinydb also allows for the creation of distinct datastores at runtime. To be honest, it is up to the developer if they want to drag out additional components (tinydb) when creating their app, it may help to simplify development. The app user will, of course, be none the wiser as to how the app is constructed....

2 Likes