Firebase DB with App Inventor tutorial

We need to see

  • what is in global Users and
  • how that value got there and
  • when it got there.

Regarding your parallel list structure, I find those very fragile.
They require you to keep all those lists in perfect sync, at risk of mismatching items down the line if you slip a gear. WHat if an item is empty or its insertion fails ?

It is more robust to keep attributes of an object together with tags, regardless of extra storage cost.

Regarding initialization of FireBase lists, you have to write an empty list to the tag value before you can do your first append to that tag.

Users are not an appropriate thing to keep in lists. Better to keep your user collection as an object with tags of unique user names, and each user tag value is an object with all its attributes, by attribute name.
That keeps all information about any particular user together.

If I understand your suggestion correctly, you are saying to use the user name as the tag, and the rest of the data would be the values? Something like in this example:

image

or like this..

image

You need an extra level, like:

  • Employee
    • ABG
      • dob
        • day: 1
        • month: 1
        • year: 1900
      • firstname: Abraham
      • lastname: Getzler
      • username: ABG
    • Carl_Aydelotte
      • dob
        • day: 1
        • month: 1
        • year: 1800
      • firstname: Carl
      • lastname: Aydelotte
      • username: Carl_Aydelotte

There are no lists here, only an Employee branch with unique sub branches, one per employee.

To update your year of birth, the tag to use would be Employee/Carl_Aydelotte/dob/year and value whatever your birth year ir.

I see .. you have given me a lot to think about ...

OK I am stuck again. I like the idea of the data structure you mention in your last post, above. I can see the merits of it from reading all the other posts about DBs and the problems that other users have run into.

example01

I am setting my bucket to 'Users' and the tags to the users' name .. its the values that I cannot seem to get right now. It's easy if there is only the one value but when there are multiples I cannot figure out the blocks. Is it some kind of list? How do I do this?

Hear that? That's frustration setting in once again. I understand the concepts, it's the execution that I can't figure out.

Wait .. i think I may have it..

Darnnit I am so close but I just cant get it ..

This isn't right, its just four values and not pairs that I can reference..

image

image

Took me long enough!

image

image

Thank you ABG for all the help. I really did learn a lot today. Trial and error has its merits.

The double slashes (//) in the tags are new to me.
I have been using single slashes.

I found that in somebody's YouTube video..

Maybe a more frequent FireBase user might have something to say on slash versus double slash in the tags.

Out of curiosity, when you said that about updating the birth year in your example, what would the blocks look like to drill down to that level? My database doesn't go that deep but I am curious..

It would be a single StoreValue with a value of your year, and a tag built up from a JOIN following the branches from left to right to reach the year, separated by / at each level.
You had the idea in saveUserData02.
The JOIN block accepts more sockets through its blue mutator button.

What's the difference here?

image

I mean I get that there are no variables and it points to a specific place but thats my question .. will I get to the year of my birth? If this were production I would use variables so I could get to anywhere but this is just an example.

I did find the bus route tutorial and it backs up my case?

Aside from the typo, no difference.
The JOIN makes it easier to read and edit.

That tutorial is not familiar to me.

This one .. I found it helpful for someone at my level of skill

Bus Schedule Tutorial

@SteveJG posted it in this thread earlier..

Hello. It works on mit a12 companion but not in my phone :frowning: ...can someone help?

What doesn't work ?

Also I suggest you drop the Table Arrangement and remake it using vertical and horizontal arrangements

app is not starting in my phone ...
if i erase that login stuff then it starts...

ok i will try that... thanks

Are you using your own firebase project or the MIT one ?