Storing Data to TinyDB behaves strangely! Is it a bug?



Please help with storing data to TinyDB.
It is behaving strangely!
What appears on tinyDB using listview is different depending on the Text of “DynamicActivityButton” and whether I am using global variables (left) or replace it with “Local Variables” (Right)
If I create 2 card views, with 2 different dynamic buttons, and whether it is local or global variables, the stored data are different! For example:

  1. Local Variable, Dynamic Button 1 (“Hi”), Button 2 (“Pear”), Button press sequence (Hi, Pear, Pear, Hi):
    Result in TinyDB: Pear, Pear (ALWAYS!) (No “Hi” stored).
  2. Local Variable, Dynamic Button 1 (“Yo”), Button 2 (“Mama”), Button press sequence (Yo, Mama, Mama, Yo):
    Result in TinyDB: Yo, Yo (ALWAYS!) (No “Mama” stored).

Look at the pattern! I can’t explain the behavior, because I did not do any alphabet or word recognition codes. So strange…

  1. Global Variable, Dynamic Button 1 (“Hi”), Button 2 (“Pear”), Button Press sequence (Hi, Pear, Pear, Hi):
    Result in TinyDB: Hi, Pear, Pear (notice no “Hi”!) (Always!)

  2. Global Variable, Dynamic Button 1 (“Yo”), Button 2 (“Mama”), Button Press sequence (Yo, Mama, Mama, Yo):
    Result in TinyDB: Yo, Mama, Mama, Yo (no Problem!) (Always!)

What on earth could be going on?!

use Do it to debug your blocks
see also tip 4 here App Inventor: How to Learn | Pura Vida Apps

EDIT: also it looks like you are not familiar with the mutator…
see here Mutators

Taifun

3 Likes

I thought I was familiar with mutators. But since you suggested I did not. Can you please enlighten me on how I can improve my coding? I am truly a newbie.

Also, I tried the “Do it” for debugging, but nothing happens. I am guessing I don’t know which blocks to apply “do it” on, Can you give suggestions please?

Unbenannt

try the TinyDB blocks, because there you think, something is wrong, isn’t it?


Taifun

3 Likes

Thanks so much Taifun. I missed the mutators of the local variable initialization thing.
And After I put the TinyDB list view on the same screen, there seems to be no problem. When I dedicate a screen to the TinyDB Listview, that’s where I am missing some words. Strange, or maybe I am missing something. I am suspecting that I missed the words due to some background lag. Some words, even with the same number of alphabets takes longer to store, I guess.

there is no such thing as a background lag for TinyDB
but if you use less screens, you will have less problems, see also tip 1 here

Taifun

2 Likes

I see. Thank you for the tip about screens. Then I don’t know how to reconcile the fact that some clicks of my buttons don’t register into TinyDB when on a different screen. It seems to magically choose specific words to do weird stuff to. Or more specifically, different alphabets because the length of string doesn’t seem to be the cause. But you are right, lagging should be indiscriminate towards alphabets, so it can’t be lagging. But neither should a screen change. So, I’d put that up as a mystery.