Firebase deleting other data

Hey,
I have a problem with my firebase, when there is a new person with a different nick instead of adding this person it replaces the other person.


image

I have no clue but I would like to make a suggestion.

Should there not be a “/” after the word “Users” in your topmost string box?

Thanks, didn't notice. I changed the tags in the store value because I was missing a / at the end but forgot about the top one, thank you.

Unfortunately I tested it out and nope it now doesn't do anything, thanks for replying tho.

Try like this:

image

Use the GetTagList to get the list of names under users (instead of returning all the data under Users)
Then check if your name in NAME_BOX is in the taglist
If not, then create the new user and their pedometer values.

This will not accumulate additional values under each user, more work required for that!

Thank you very much I was actually waiting for you because you know a lot about firebase. And I have 2 questions. 1 Will it work for 3-4 people? and 2 is the text below the screenshots what I have to do or is it explaining what is the code doing?

  1. Yes, on the same device or on different devices
  2. Just explains what the blocks are doing

Just get your baseProjectBucket correct. Your data is another level down to mine.

Okay, thanks. But what am I doing wrong?


It's probably the baseProjectBucket but I don't know. And there is nothing about adding a new name to the firebase and under it adding the steps and distance?

Yours should look like this:

The baseProjectBucket is what you see in the Designer.

Thanks a lot it worked, now it really made firebase stuff confusing for me now since last time it was so complicated and big and now it is so small and simply made.
Can you please have a quick look at this and tell me what's wrong?


I want it to make a leader board of all users and their steps and distance. By using the dynamic components extension I made it so that it will make a name label, steps label and a distance label and some layouts to make it nicer and cleaner. But I don't know how to do it so that it will do it for each one of the users in the firebase especially I'm stuck on the part when it has to get the name of each user and I don't know how to do it so I can do it max for 1 person, and I'm really but at lists and the dictionaries. I just tried to make it from what I know and what you told me earlier.

Leaderboard... most steps or longest distance ?

Can't it be both, steps and distance for every user and the one with the most distance goes on top, i can show u what i mean when ill get on my pc and i can send h the .aia file

So longest distance is what puts your leader at the top!

Name:Distance:Steps

Yea, it's all done. But I don't know how to grab the users from the firebase and out that value into the labels and i dont know how to sort the leader board so that the person with biggest distance wins

OK, this is not pretty, but it gets the job done.

  1. Call back all the Users data
  2. Set the distance and steps values to a list of texts, with distance first, and adding leading zeros to ensure they are alphanumeric for sorting (if steps/distance will be more than 999 then change digits to 4 in the procedure
  3. Add the user name to the texts at the end
  4. Sort this list which gets longest distance first. Using the ListUtils extension.
  5. Now reorder the list so that it is name,distance.steps
  6. display in label

image

image

image

You have a list of each user in the correct order (leaderboard) which you can apply to your dynamic components.

The GotValue block should be draggable into your project, but create the other blocks first.

Thanks, that's what I did, I have a question tho. It doesn't add anything to the firebase, was I supposed to delete the firebase.taglist and change the set project bucket to what you change it here and get rid of the get tag list?

This has nothing to do with the taglist or uploading of data, this set of blocks simply fetches the user data and generates a sorted leaderboard. You can make a procedure of it and then call it when a user adds new data. You would need the dataChanged event in order to update all users on different devices.

Okay, thank you. I wanted to quickly test it so I just made a label called Label2 but it doesn't show anything. On the firebase I can see the users and their stats but the text of the Label2 just goes blank instead of showing the users and their data, why is it happening?

(Here is the app file if you need to check the blocks: Family_Pedometer.aia (518.0 KB) )

Work through your blocks using Do It. I used global variables to make this easier.

Tried it but can't find the error at all, and I don't know what to put in the values. When did "do it" on the set label2 text to users and their stats block nothing happened it just went blank.