Using TinyDB and any component in virtual screens

Yeah, virtual screen [mod edit personal info removed] what I want

Sorry I don't understand anything you say.

The problem is that I need to go to a parallel screen (map screen), so I need to use Tiny DB, because variables desapear between screens.

Thanks

is it possbile get the vertical arrangement index?

Here are two sample apps where components are kept in dictionaries that assign them names for storage:

Thanks for the clue

I have just discovered that if I store the index of the vertical arrangement in tiny db and in another moment get the value and use in this block, I get the mentioned error

image

On the other hand If I make a simple list storing the intex of the vertical arrangements:

image

It works pefectly:

But, as said, I can't store the vertical arrangement's indexes in Tiny DB.

Maybe this is related with the fact that storing in DB the data is converted in a string. So the question is to know what kind of data is spected in "COMPONENT" parámeter in this block,

image

Thanks in advance

1845e6959b186e7677d3905e46109e274b3b1467_2_690x254

Thanks @ABG , but he blocks marked by you works perfectly.

The tynyDB is initialited as a list of list as follow:

image

The issue is with COMPONENT parámeter, which curiously does not work with a stored value in TinyDB

I believe you have been given the answer about five times now, but not managed to apply it to your project.

See if this simple aia project helps to explain what you need to do in order to save the index of a VA to the tinydb

SaveVAOpen.aia (2.7 KB)

1 Like

Thanks Meritcat @TIMAI2 , finally you have explained really well. I didn't understand what other users say to me...

I have no words to thank you for your help. I have wasted a lot of Sunday's hours.

Your solution is really simple and smart: only storing the index of the visible arragement in TinyDB

In any case, I'm curious why storing the list of arrays in a list located in the database didn't work.

However, I am somewhat annoyed with the inflexibility of appinventor: It is true that my level of programming is very basic, but I usually solve problems by writing pseudocode that I later have a hard time bringing to APP INVENTOR because I feel that it has some absurd limitations that lead me to problems whose solution are "video game cheats".

Thanks again

Components like vertical arrangements are created at runtime, when the app initialises, and each component is given a unique name. This unique name can be used in that session of the app, but next time you run the app the components are initialised again with new unique names. Therefore if you attempt to store one of these unique names in a tinydb, it will not exist in the app the next time you run it.

Also, you cannot store strings of component names and expect them to return a component.

1 Like

Hello again

I understand what you're saying, but not completely:

In my last trials, what I have saved in the database, is the same that you done in "vaList" : the content of the block of the arrangement that gave me its block as a result: something like "com.google.appinventor.components.runtime.VerticalArrangement@ xxxxxx"

Where xxxx is what changes at every arrangement. So, theorically it should work, becasuse I stored, as you, the unique session name in a list every time the screen initializes

Maybe when it is stored in TinyDB the coding change to a text (string) or something like that (maybe xxxxx is hexadecimal)

Kind regards and I'll read you tomorrow, I go to bed