I need help with Firebase data handling

Hello everyone , I'm making an app for my school, it will be for a few classes (301 - 305).
Here on Brazil, we have to decide 2 or less people that is chosen to represent the class, They're referred as "Representantes".

There are 2 apps:
TheStudentTime: App where my classmates would use to see current news for the class.
TSTDEV: App where those "Representantes" would send the news for TheStudentTime.

I have the knowledge on a few languages such as python, and i know how easy it is to handle JSON in python, is there a way that i could implement that on MIT in any way? The apps are working and i just made a meeting with all those "Representantes" and they basically "ate me alive" with the things that couldve been changed or to change.

So I'm here asking for help, since with the better handling with the firebase information, it would make my life easier.

I'll be editing this post with the following codes that i use to handle the firebase files, but any help would be appreciated.

The screenshot shows how's the information is being handled.It basically shows in a ListView

You don't:

  1. Say what your problem is
  2. Show what you want the data to look like in the listview
  3. Show your relevant blocks for interacting with Firebase
  4. Indicate how the data is getting to Firebase
  5. Say whether you are using the firebase component
  6. Confirm that you are using AppInventor, and not another variant, e.g. Kodular, Niotron...

1- I need help with how i handle data from Google´s Firebase, if theres a better way or not ( As i mentioned above using python)
2-


3- This is how u get the info from database (note how complicated it is) (code from TheStudentTime)

4-
image

5-

6- Yes, its MIT
How it looks on TheStudentTime APP
image
How it looks on TSTDEV
image

CODE THAT IS ON THE DEV APP:

Here is how the App works

  1. Explain what you mean by "handle"? Do you mean how do you store and retrieve data? If you return a json from firebase how do you read it ? Something else ?

  2. I do not see any data called "info1,info2,info...." in your firebase data ?

  3. What are the startValue tags, where do they come from, and what do they return (set the returned value to a label to see) - oh, doesn't look all that complicated, but possibly over-complicated

  4. Do you really need 4 firebase components, when one will do the job ?

  5. Yes, I see from your blocks in 3 that you are using AppInventor

1- Yes, how i store and retrieve data. Ive noticed that in python is as easy as importing a library that will automatically get the text from it. For example, if i normally, without the blocks on MIT, it would retrieve for example -> "{(Math})", and that isnt very.. good for the user, thats why the blocks are there, to show "Math". (aka to be more clean)

2- The "Info1,info2,info..." are just to show that i want it to show as a pop up, where it shows a list of news for the past minute
image

3- Ah, the start values are simply to see which "Representante" joined, just so i can control who is sending what, so i dont get in trouble with my school if someone sends smth.... not cool
The startvalues are the Classes

4- Good question, i dont know. I learned that way, and it worked :man_shrugging:

5- :smiley:

If you are interested, how to use the web component to access firebase:

  1. There aren't enough days to explain everything, so in brief, using the firebase component and this simple dataset

image

If I set the project Bucket to empty and the tag to empty, then firebase will return the entire project contents as a json. ( I am not going to do this one....)

If I set the project bucket to empty, and the tag to dogFeeder, then firebase will return the entire contents of dogFeeder as a json

image

image

image

If I set the projectBucket to dogFeeder, and leave the tag empty, it returns the same as above

image

image

image

If I set the projectBucket to dogFeeder and the tag to columnChartData Firebase returns all the data under columnChartData as a json

image

image

If I set the projectBucket to dogFeeder and the tag to "columnChartData/ComidaGrande", firebase will return the value for ComidaGrande, e.g. "20"

image

image

Given that many of the returns from Firebase are as json, you can then choose how you wish to deal with the data on return. You can use the dictionary blocks or the list blocks. AI2 already sees the returned json as a dictionary:

image

image

but you need to convert the json to a list using a block from the web component

image

image

There you are a brief intro to "handling" data from firebase using the firebase component, dictionaries and lists.

interesting, if i wanted to get rid of the [[ ]], would i have to do what ive done? aka this:

Use the select item from list again on a select item if you have a list inside a list (list of lists) e.g.

[[dog,[cat],[pig]]

select item from list - index 1, select item from list - index 2 = cat

This should also remove the double quotes

can u pls show the blocks to it? by text is a lil confusing.

(in the actual label there are no double quotes)