How do I create a list of tags in firebase?

Hello,
I want do send the data to the fire base with the tag User and a number, if there is already a "User1" then it would change the number by 1 so that another user's tag would be "User2". Does anybody know how to do this? I was testing it with join function but I really can't think of anything, I tried to make a list in the fire base but can't understand how it works.

image

@Niu Make it so that checks to see if the username is in the list, if not it adds the username to the list, if so, if it has a number(1-9), split text at number , get the number, add 1 to it, join it with the username, then add to the list, if it does not have a number, join text 'username' with '1'. Give me a sec to put it into blocks in ai2, if you didn't understand that.

Yea, I don't really get how to do this with blocks sorry, I'm new to Mit app inventor and even more new to the fire base, all I know is how to send data and retrieve data.

Here's the blocks...


Couldn't find the Tinyfb... should be under the Tinydb in the same drawer.
Screenshot 2021-01-28 at 10.23.02 AM

Let me know if you find any bugs.

Can you show it on my app because I don't really know how to connect it to mine thing and some of the thing are shorten like the make a list... and I don't know or see Tinyfb, is it an extention?

Here is the .aia file: and It's in the Start screen.
Business_Tycoon_Test.aia (227.6 KB)

All unedited block images are directly draggable into the blocks editor.

Oh, didn't know that. But when i drag it in the screen turn green and there's a plus icon but when i drop it nothing happens. Do I have to wait a while or drop it in a specyfic place or something?

Ok, I'll just edit your project for you if you are having bugs.

Okay, thank you so much for spending time helping me :slight_smile:

1 Like

I just added the components in the blocks editor. Don't know where you want it though,
Read the comment on the block.
Business_Tycoon_Test (1).aia (230.7 KB)

I have a feeling that i might have to add a search list feature instead of the isinlist block, because the list won't find User9 when looking for anything that has User in it, only User. If that is the case, I'll add that feature when I come back from lunch. In the meantime, test it, and let me know if that is an issue. Also, take a shot at adding the search feature if that is an issue. I can always fix your code. :wink: :stuck_out_tongue_winking_eye:

ok thank you very much, ill try it out now and play with it for a bit

1 Like


Is this the correct way of doing this? Cause I'm getting a firebase error "Previous value was empty". And what's a UN?

@Niu UN is short for Username. Check UN is supposed to be the value stored, not the tag for the value store (although, you can set the tag as the result stored as a global variable). The error is probably because you are using an append value block, instead of a store.value block. Append value edits the value already stored in the Firebase. In your case, there isn't a value to edit, so an error occurs.

To set the tag as the result, put this block down in Under the set result block at the bottom of the procedure. ↓


blocks (23)

And for the tag, set this block as the input.

lexical_variable_get

I made it like this but now it stops at User1 and doesn't wanna go any further


(ill be afk for 10-15 minutes)

1 Like

firebase:
image

Yeah, I'll have to fix that with the search procedure.

Thank you so much for helping and I have a question, will it be able to go forever or just to a certain number like 10 or 20? (sorry I don't really get how it works from looking at it)

Hey, I tried it on 2 android devices and idk how but it kind of broke. Now instead of User, User0, User1 I see this:
image
and when I do it with another device instead of creating a new one it just changes this one.
But I didn't change anything I just added the "get global Current_UN". Any idea why this is happening?

Iḿ correcting your code. BRB in 5. I might have fixed it with this version I'ḿ working on.