Need help with listview, firebase and dynamic components

I am creating this app with a database on firebase where you can storage information about a crop (the number and name of it).

I want that the information stored on the database on firebase can be shown to the user via a list, that is why I am using the listview. but I am having some problems:

  • I can not use the taglist from Firebase, so when I get the information from there to the listview it is on json format and I don not know how to change it.
  • about the dynami components, I can create buttons but when I create a new one it overwrites the previous one, and I want that all buttons stay at the same time on the screen.
  • I can not find a way to make that the listview selection appears on a textbox, like when you select something.

I hope I made myself clear, I really need some help with this.

Why not ?

Why dynamic components, if you have your data in a listview, use the after selecting event to direct the user to another screen ?

Because I need that when a new elemelent is added to the listview it creates a button that leads the user to another screen. That is why I used dynamic components. Maybe what you say is also a good idea, but how I said, it seems that I can not make work the selection option of the listview. I you could hello me with that I would apreciate it.

Pd: I can not use the tag Lost from firebase because it also does not works. Every tutorial I saw uses it, but I can not make it work.

Are you using the taglist blocks correctly?

I see you call the taglist, but do not use the gotTaglist event (where the tags are returned as a list)

From what you say using the listview will make much more sense than creating buttons. What don't you understand about the afterSelecting event ?

That is because I am not using the tag list, maybe i left that block there. but when I tried to use it following various tutorials, it did not work and that is why I had to use a list, but I would preffer to use the taglist instead of lists.
and about the listview selection, I do not understand how to put the text from that selection on a textbox and how to do what you are saying instead of the dynamic buttons.

Show your data in the firebase console if using your own firebase project, or are you using the MIT provided instance?

Firebase doesn't like numbers to be used as tags (e.g. 1,2,3,4) this confuses firebase because it thinks you are using an array, which firebase handles differently. This might be why the taglist does not work.

image
I am using the first one. Maybe you are right about the numbers. But how can I order the data without using numbers?

Yep, that will cause a problem

Use something like:

00001
00002
00003
...
00010
00011
....

these will be strings and sort alphabetically

1 Like

and this also begs the question, if you were intending to create a button for each item in your list, and the buttons are for opening a screen, how many screens are you intending to have ?

For listview use, if you are on Screen1:

1 Like

They are for the same screen because how you say, there would be too many screens.
Also I am going to try the number thing with the tag list and the listview thing. I will tell if it works. Thanks for the help so far.

then perhaps:

image

(again assumes you are starting on Screen1)

1 Like

You could also simplify your data:

Cultivos
    00001:"papa"
    00002:"tomate"
    00003:"lechuga"

...

I was going to ask that. How could I simplify my data?
because for now it shows the information like that, but I want that the name of the crop and the number of it appear together on the listview.

And about the other things, it all worked. Thanks for the help.

You could do like this:

Cultivos
    00001-papa
        code: "00001"
        crop: "papa"
    00002-tomate
        code: "00002"
        crop: "tomate"
    00003-lechuga
        code: "00003"
        crop: "lechuga"
...

But how could I do that from app inventor? Like when I am registering the data how could I organize it that the order is how you are showing?

I think I hve done it.


Thank you very much for your help.

You appear to have code and crop around the wrong way, meaning you will only be able to sort your taglist by crop....

for the first one:

image

for the second one:

image

1 Like

It does not seem to work. Maybe I am doing it wrong, but anyways, you were really helpful, thanks.